Skip to content

Commit

Permalink
Updated the code reveiw comments
Browse files Browse the repository at this point in the history
  • Loading branch information
md-rafeek committed Dec 17, 2024
1 parent 347400e commit 4134280
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions plugins/modules/network_settings_workflow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
The default value is false.
type: bool
required: false
default: false
reserve_pool_details:
description: Reserved IP subpool details from the global pool.
Expand Down Expand Up @@ -235,10 +236,12 @@
type: bool
force_delete:
description: >
Forcefully delete all IP pools from the global level of the global pool.
Forcefully delete all IP pools from the reserve level of the IP sub-pool.
The default value is false.
type: bool
required: false
default: false
network_management_details:
description: Set default network settings for the site
type: list
Expand Down Expand Up @@ -1900,6 +1903,8 @@ def global_pool_exists(self, name):
all_global_pool.append(global_del_pool)

if len(all_global_pool_details) < 25:
self.log("Found {0} record(s), No more record available for the next offset"
.format(str(len(all_global_pool_details))), "INFO")
break

offset += 25
Expand Down Expand Up @@ -3848,43 +3853,43 @@ def delete_ip_pool(self, name, pool_id, function_name, pool_type):
function_name).check_return_status()
self.log("Response received from delete {0} pool API: {1}".
format(pool_type, self.pprint(response)), "DEBUG")
executionid = response.get("executionId")

execution_id = response.get("executionId")
success_msg, failed_msg = None, None
execution_details = {}

if pool_type == "Global":
success_msg = "Global pool deleted successfully"
failed_msg = "Unable to delete global pool reservation"
else:
success_msg = "Ip subpool reservation released successfully"
failed_msg = "Unable to release subpool reservation"

if executionid:
execution_details = {
if execution_id:
return {
"name": name,
"execution_id": executionid,
"msg": success_msg
"execution_id": execution_id,
"msg": success_msg,
"status": "success"
}
else:
self.msg = "No execution id received:'{name}'".format(name=name)
self.log(str(self.msg), "ERROR")
execution_details = {
"name": name,
"execution_id": None,
"msg": failed_msg
}

return execution_details
self.log("No execution ID received for '{name}'".format(name=name), "ERROR")
return {
"name": name,
"execution_id": None,
"msg": failed_msg,
"status": "failed"
}

except Exception as msg:
self.msg = (
"Exception occurred while deleting the {type} pool with the name '{name}': {msg}"
.format(name=name, msg=msg, type=pool_type)
except Exception as e:
error_msg = (
"Exception occurred while deleting the {type} pool with the name '{name}': {error}"
.format(name=name, error=str(e), type=pool_type)
)
self.log(str(msg), "ERROR")
self.set_operation_result("failed", False, self.msg, "ERROR").check_return_status()

return self
self.log(error_msg, "ERROR")
return {
"name": name,
"execution_id": None,
"msg": error_msg,
"status": "failed"
}

def delete_reserve_pool(self, reserve_pool_details):
"""
Expand Down

0 comments on commit 4134280

Please sign in to comment.