Skip to content

Commit

Permalink
Add type defininitions for dicts, more...
Browse files Browse the repository at this point in the history
1. ImagePolicyAction: Add type definitions for dicts

2. ImageStage, ImageValidate, ImageUpgrade: Add clarifying comments
  • Loading branch information
allenrobel committed Jan 18, 2024
1 parent cd329e0 commit 71cd2fc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/module_utils/image_mgmt/image_policy_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def build_payload(self):
self.switch_issu_details.refresh()
for serial_number in self.serial_numbers:
self.switch_issu_details.filter = serial_number
payload = {}
payload: Dict[str, Any] = {}
payload["policyName"] = self.policy_name
payload["hostName"] = self.switch_issu_details.device_name
payload["ipAddr"] = self.switch_issu_details.ip_address
Expand Down Expand Up @@ -238,7 +238,7 @@ def _attach_policy(self):
self.properties["response"] = response

for payload in self.payloads:
diff = {}
diff: Dict[str, Any] = {}
diff["action"] = self.action
diff["ip_address"] = payload["ipAddr"]
diff["logical_name"] = payload["hostName"]
Expand Down Expand Up @@ -281,7 +281,7 @@ def _detach_policy(self):

for serial_number in self.serial_numbers:
self.switch_issu_details.filter = serial_number
diff = {}
diff:Dict[str, Any] = {}
diff["action"] = self.action
diff["ip_address"] = self.switch_issu_details.ip_address
diff["logical_name"] = self.switch_issu_details.device_name
Expand Down
1 change: 1 addition & 0 deletions plugins/module_utils/image_mgmt/image_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def commit(self):
diff["logical_name"] = self.issu_detail.device_name
diff["policy"] = self.issu_detail.policy
diff["serial_number"] = serial_number
# See image_upgrade_common.py for the definition of self.diff
self.diff = copy.deepcopy(diff)

def _wait_for_current_actions_to_complete(self):
Expand Down
1 change: 1 addition & 0 deletions plugins/module_utils/image_mgmt/image_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ def commit(self) -> None:

self.response = copy.deepcopy(response)
self.response_data = response_data
# See image_upgrade_common.py for the definition of self.diff
self.diff = copy.deepcopy(self.payload)

self._wait_for_image_upgrade_to_complete()
Expand Down
1 change: 1 addition & 0 deletions plugins/module_utils/image_mgmt/image_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def commit(self) -> None:
diff["logical_name"] = self.issu_detail.device_name
diff["policy"] = self.issu_detail.policy
diff["serial_number"] = serial_number
# See image_upgrade_common.py for the definition of self.diff
self.diff = copy.deepcopy(diff)

def _wait_for_current_actions_to_complete(self) -> None:
Expand Down

0 comments on commit 71cd2fc

Please sign in to comment.