Skip to content

Commit e3303bc

Browse files
Merge branch 'main' into non_update
2 parents 5cdf531 + 0438f32 commit e3303bc

83 files changed

Lines changed: 1477 additions & 65 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ah_token_refresh.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
jobs:
99
refresh:
10-
uses: ansible/team-devtools/.github/workflows/ah_token_refresh.yml@main
10+
uses: ansible/ansible-content-actions/.github/workflows/refresh_ah_token.yaml@main
1111
with:
1212
environment: release
1313
secrets:

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ jobs:
111111
strategy:
112112
matrix:
113113
ansible:
114-
- stable-2.15
114+
- stable-2.17
115115
python-version:
116116
- 3.11
117117
netscaler-version:
118-
- 13.1-49.15
119-
- 14.1-4.42
118+
- 13.1-58.20
119+
- 14.1-47.29
120120
steps:
121121
- name: Checkout the repo
122122
uses: actions/checkout@v4

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [2.9.0] - 2025-05-13
11+
12+
### Added
13+
14+
- Supported operation `apply`
15+
- Supported operation `rename`
16+
- Supported operation `install`([#487])
17+
18+
### Fixed
19+
20+
- Allowing system file to update contents([#496])
21+
1022
## [2.8.0] - 2025-02-18
1123

1224
### Added
25+
1326
- Supported enable/disable for GSLB service operations([#452])
1427

1528
### Fixed
@@ -150,8 +163,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
150163
### Added
151164

152165
- Initial Release
153-
154-
[unreleased]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.8.0...HEAD
166+
[unreleased]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.9.0...HEAD
167+
[2.9.0]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.8.0...2.9.0
155168
[2.8.0]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.7.0...2.8.0
156169
[2.7.0]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.6.2...2.7.0
157170
[2.6.2]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.6.1...2.6.2

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ build:
3939
ansible-galaxy collection build --force
4040

4141
galaxy_importer: build
42-
python3 -m galaxy_importer.main netscaler-adc-2.8.0.tar.gz
42+
python3 -m galaxy_importer.main netscaler-adc-2.9.0.tar.gz
4343

4444
# build_docs:
4545
# rm -rf _built_docs

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace: netscaler
77
# The name of the collection. Has the same character restrictions as 'namespace'
88
name: adc
99
# The version of the collection. Must be compatible with semantic versioning
10-
version: 2.8.0
10+
version: 2.9.0
1111
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1212
readme: README.md
1313
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)

plugins/module_utils/common.py

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -190,29 +190,47 @@ def _check_create_resource_params(resource_name, resource_module_params, action=
190190
]
191191
except KeyError:
192192
resource_action_keys = []
193-
194-
# TODO: Should we allow non-add keys for the resource? OR should we error out if any non-add key is passed?
195-
for key in resource_module_params.keys():
196-
if not action:
197-
if key in resource_add_keys:
198-
post_data[key] = resource_module_params[key]
199-
elif resource_name == "service" and key == "ipaddress":
200-
post_data["ip"] = resource_module_params[key]
201-
else:
202-
log(
203-
"WARNING: Key `{}` is not allowed for the resource `{}` for CREATE operation. Skipping the key for the operation".format(
204-
key, resource_name
205-
)
206-
)
193+
if action == "rename":
194+
oldnamekey = NITRO_RESOURCE_MAP[resource_name]["primary_key"]
195+
if oldnamekey in resource_module_params:
196+
post_data[oldnamekey] = resource_module_params[oldnamekey]
197+
else:
198+
msg = "ERROR: Key `{}` is required for the resource `{}` for RENAME operation".format(
199+
oldnamekey, resource_name
200+
)
201+
log(msg)
202+
return False, msg, None
203+
if "newname" in resource_module_params:
204+
post_data["newname"] = resource_module_params["newname"]
207205
else:
208-
if key in resource_action_keys:
209-
post_data[key] = resource_module_params[key]
206+
msg = "ERROR: Key `newname` is required for the resource `{}` for RENAME operation".format(
207+
resource_name
208+
)
209+
log(msg)
210+
return False, msg, None
211+
else:
212+
# TODO: Should we allow non-add keys for the resource? OR should we error out if any non-add key is passed?
213+
for key in resource_module_params.keys():
214+
if not action:
215+
if key in resource_add_keys:
216+
post_data[key] = resource_module_params[key]
217+
elif resource_name == "service" and key == "ipaddress":
218+
post_data["ip"] = resource_module_params[key]
219+
else:
220+
log(
221+
"WARNING: Key `{}` is not allowed for the resource `{}` for CREATE operation. Skipping the key for the operation".format(
222+
key, resource_name
223+
)
224+
)
210225
else:
211-
log(
212-
"WARNING: Key `{}` is not allowed for the resource `{}` for `{}` action. Skipping the key for the operation".format(
213-
key, resource_name, action.upper()
226+
if key in resource_action_keys:
227+
post_data[key] = resource_module_params[key]
228+
else:
229+
log(
230+
"WARNING: Key `{}` is not allowed for the resource `{}` for `{}` action. Skipping the key for the operation".format(
231+
key, resource_name, action.upper()
232+
)
214233
)
215-
)
216234

217235
return True, None, post_data
218236

@@ -601,6 +619,10 @@ def get_valid_desired_states(resource_name):
601619
desired_states.add("switched")
602620
if "unset" in supported_operations:
603621
desired_states.add("unset")
622+
if "Install" in supported_operations or "install" in supported_operations:
623+
desired_states.add("installed")
624+
if "rename" in supported_operations:
625+
desired_states.add("renamed")
604626
if "apply" in supported_operations:
605627
desired_states.add("applied")
606628
return desired_states

plugins/module_utils/module_executor.py

Lines changed: 21 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
@@ -375,6 +382,14 @@ def is_resource_identical(self):
375382

376383
return (False, None) if diff_list else (True, None)
377384

385+
@trace
386+
def install(self):
387+
ok, err = create_resource(
388+
self.client, self.resource_name, self.resource_module_params
389+
)
390+
if not ok:
391+
self.return_failure(err)
392+
378393
@trace
379394
def create_or_update(self):
380395
self.update_diff_list(
@@ -463,7 +478,7 @@ def create_or_update(self):
463478
self.client, self.resource_name, self.resource_module_params
464479
)
465480

466-
elif immutable_keys_list is None:
481+
elif immutable_keys_list is None or self.resource_name in skippable_resource_list:
467482
self.module_result["changed"] = True
468483
log(
469484
"INFO: Resource %s:%s exists and is different. Will be UPDATED."
@@ -980,12 +995,16 @@ def main(self):
980995
if "bindings" in NITRO_RESOURCE_MAP[self.resource_name].keys():
981996
self.sync_all_bindings()
982997

998+
elif self.resource_name == "install" and self.module.params["state"] == "installed":
999+
self.install()
1000+
9831001
elif self.module.params["state"] in {
9841002
"created",
9851003
"imported",
9861004
"flushed",
9871005
"switched",
9881006
"unset",
1007+
"renamed",
9891008
"applied",
9901009
}:
9911010
state_action_map = {
@@ -994,6 +1013,7 @@ def main(self):
9941013
"flushed": "flush",
9951014
"switched": "switch",
9961015
"unset": "unset",
1016+
"renamed": "rename",
9971017
"applied": "apply",
9981018
}
9991019
self.act_on_resource(

0 commit comments

Comments
 (0)