Skip to content

Commit 14f1876

Browse files
Merge branch 'main' into action_keys
2 parents bb30799 + 4957938 commit 14f1876

4 files changed

Lines changed: 35 additions & 4 deletions

File tree

plugins/module_utils/common.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ def get_valid_desired_states(resource_name):
619619
desired_states.add("switched")
620620
if "unset" in supported_operations:
621621
desired_states.add("unset")
622+
if "Install" in supported_operations or "install" in supported_operations:
623+
desired_states.add("installed")
622624
if "rename" in supported_operations:
623625
desired_states.add("renamed")
624626
if "apply" in supported_operations:

plugins/module_utils/module_executor.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@
4444
from .nitro_resource_map import NITRO_RESOURCE_MAP
4545

4646

47+
skippable_resource_list = [
48+
# In some cases, although keys are listed as immutable in the nitro_resource_map, they can actually be updated.
49+
# This list helps bypass the immutability check for these resources.
50+
"sytemfile"
51+
]
52+
53+
4754
class ModuleExecutor(object):
4855
def __init__(self, resource_name, supports_check_mode=True):
4956
self.resource_name = resource_name
@@ -365,6 +372,14 @@ def is_resource_identical(self):
365372

366373
return (False, None) if diff_list else (True, None)
367374

375+
@trace
376+
def install(self):
377+
ok, err = create_resource(
378+
self.client, self.resource_name, self.resource_module_params
379+
)
380+
if not ok:
381+
self.return_failure(err)
382+
368383
@trace
369384
def create_or_update(self):
370385
self.update_diff_list(
@@ -453,7 +468,7 @@ def create_or_update(self):
453468
self.client, self.resource_name, self.resource_module_params
454469
)
455470

456-
elif immutable_keys_list is None:
471+
elif immutable_keys_list is None or self.resource_name in skippable_resource_list:
457472
self.module_result["changed"] = True
458473
log(
459474
"INFO: Resource %s:%s exists and is different. Will be UPDATED."
@@ -957,6 +972,9 @@ def main(self):
957972
if "bindings" in NITRO_RESOURCE_MAP[self.resource_name].keys():
958973
self.sync_all_bindings()
959974

975+
elif self.resource_name == "install" and self.module.params["state"] == "installed":
976+
self.install()
977+
960978
elif self.module.params["state"] in {
961979
"created",
962980
"imported",

plugins/module_utils/nitro_resource_map.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30622,6 +30622,15 @@
3062230622
"create": [],
3062330623
"force": [],
3062430624
"import": [],
30625+
"install": [
30626+
"a",
30627+
"async",
30628+
"enhancedupgrade",
30629+
"l",
30630+
"resizeswapvar",
30631+
"url",
30632+
"y",
30633+
],
3062530634
"link": [],
3062630635
"switch": [],
3062730636
"unlink": [],

plugins/modules/install.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@
1919
DOCUMENTATION = r"""
2020
---
2121
module: install
22-
short_description: Configuration for 0 resource.
23-
description: Configuration for 0 resource.
22+
short_description: Configuration for install resource.
23+
description: Configuration for install resource.
2424
version_added: 2.0.0
2525
author:
2626
- Sumanth Lingappa (@sumanth-lingappa)
2727
- Shiva Shankar Vaddepally (@shivashankar-vaddepally)
2828
options:
2929
state:
30-
choices: []
30+
choices:
31+
- installed
3132
default: present
3233
description:
3334
- The state of the resource being configured by the module on the NetScaler
3435
ADC node.
36+
- When C(Install), the resource will be installed on the NetScaler ADC node.
3537
type: str
3638
async:
3739
type: bool

0 commit comments

Comments
 (0)