Skip to content

Commit

Permalink
commit 1
Browse files Browse the repository at this point in the history
  • Loading branch information
shivashankar-vaddepally committed Jan 20, 2025
1 parent c57cbb5 commit 14fbf16
Show file tree
Hide file tree
Showing 8 changed files with 4,005 additions and 3,834 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
ansible:
- stable-2.15
- stable-2.16
- stable-2.17
python-version:
- "3.11"
steps:
Expand Down
6 changes: 6 additions & 0 deletions plugins/module_utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ def save_config(client, all=False):

@trace
def enable_resource(client, resource_name, resource_params):
if resource_name == "gslbservice":
resource_name = "service"
resource_params["name"] = resource_params["servicename"]
post_payload = {resource_name: {}}
enable_payload_keys = NITRO_RESOURCE_MAP[resource_name]["enable_payload_keys"]

Expand All @@ -483,6 +486,9 @@ def enable_resource(client, resource_name, resource_params):

@trace
def disable_resource(client, resource_name, resource_params):
if resource_name == "gslbservice":
resource_name = "service"
resource_params["name"] = resource_params["servicename"]
post_payload = {resource_name: {}}
disable_payload_keys = NITRO_RESOURCE_MAP[resource_name]["disable_payload_keys"]

Expand Down
9 changes: 9 additions & 0 deletions plugins/module_utils/module_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def __init__(self, resource_name, supports_check_mode=True):
argument_spec = dict()
argument_spec.update(NETSCALER_COMMON_ARGUMENTS)
argument_spec.update(module_specific_arguments)
if self.resource_name == "gslbservice":
self.valid_states.add("enabled")
self.valid_states.add("disabled")
module_state_argument = dict(
state=dict(
type="str",
Expand Down Expand Up @@ -412,11 +415,17 @@ def create_or_update(self):
"INFO: module_params has keys %s which are not part of `add_payload_keys`. Hence updating the resource again"
% keys_in_upload_payload_and_not_in_add_payload
)
siteName = None
if self.resource_name == "gslbservice":
siteName = self.resource_module_params.get("sitename")
self.resource_module_params.pop("sitename", None)
ok, err = update_resource(
self.client, self.resource_name, self.resource_module_params
)
if not ok:
self.return_failure(err)
if siteName:
self.resource_module_params["sitename"] = siteName
else:
# Update only if resource is not identical (idempotent)
if self.is_resource_identical():
Expand Down
Loading

0 comments on commit 14fbf16

Please sign in to comment.