Skip to content

Commit

Permalink
addressed PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rukapse committed Oct 21, 2024
1 parent 92e0eab commit 1466054
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
21 changes: 17 additions & 4 deletions plugins/module_utils/dnac.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,10 @@ def get_site_id(self, site_name):
site_exists = True

except Exception as e:
self.msg = "An exception occurred while retrieving Site details for Site '{0}' does not exist in the Cisco Catalyst Center. Error: {1}".format(site_name, e)
self.msg = (
"An exception occurred while retrieving Site details for Site '{0}' does not exist in the Cisco Catalyst Center. "
"Error: {1}".format(site_name, e)
)
self.fail_and_exit(self.msg)

return (site_exists, site_id)
Expand Down Expand Up @@ -1619,7 +1622,12 @@ def get_task_status_from_tasks_by_id(self, task_id, task_name, success_msg):
elapsed_time = time.time() - loop_start_time
# Check if the elapsed time exceeds the timeout
if self.check_timeout_and_exit(loop_start_time, task_id, task_name):
self.log("Timeout exceeded after {0:.2f} seconds while monitoring task '{1}' with task ID '{2}'.".format(elapsed_time, task_name, task_id), "DEBUG")
self.log(
"Timeout exceeded after {0:.2f} seconds while monitoring task '{1}' with task ID '{2}'.".format(
elapsed_time, task_name, task_id
),
"DEBUG"
)
break

# Check if the task has completed (either success or failure)
Expand Down Expand Up @@ -1692,7 +1700,12 @@ def get_task_status_from_task_by_id(self, task_id, task_name, failure_msg, succe
# Check if the elapsed time exceeds the timeout
elapsed_time = time.time() - loop_start_time
if self.check_timeout_and_exit(loop_start_time, task_id, task_name):
self.log("Timeout exceeded after {0:.2f} seconds while monitoring task '{1}' with task ID '{2}'.".format(elapsed_time, task_name, task_id), "DEBUG")
self.log(
"Timeout exceeded after {0:.2f} seconds while monitoring task '{1}' with task ID '{2}'.".format(
elapsed_time, task_name, task_id
),
"DEBUG"
)
break

# Extract data, progress, and end time from the response
Expand All @@ -1701,7 +1714,7 @@ def get_task_status_from_task_by_id(self, task_id, task_name, failure_msg, succe
end_time = response.get("endTime")
self.log("Current task progress for '{0}': {1}, Data: {2}".format(task_name, progress, data), "INFO")

# Validate task data or progress if validation keys are provided
# Validate task data or progress if validation keys are provided
if end_time:
if data_validation and data_validation in data:
self.msg = success_msg
Expand Down
10 changes: 7 additions & 3 deletions plugins/modules/network_compliance_workflow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,13 @@ def validate_compliance_operation(self, run_compliance, run_compliance_categorie
Raises:
Exception: If no compliance operation is requested, raises an exception with a message.
"""
self.log("Validating if any network compliance operation is requested: "
"run_compliance={0}, run_compliance_categories={1}, sync_device_config={2}".format(
run_compliance, run_compliance_categories, sync_device_config), "DEBUG")
self.log(
"Validating if any network compliance operation is requested: "
"run_compliance={0}, run_compliance_categories={1}, sync_device_config={2}".format(
run_compliance, run_compliance_categories, sync_device_config
),
"DEBUG"
)

if not any([run_compliance, run_compliance_categories, sync_device_config]):
self.msg = (
Expand Down

0 comments on commit 1466054

Please sign in to comment.