diff --git a/CHANGELOG.md b/CHANGELOG.md index 069614d6c..d87e2001b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.6.1] - 2024-04-29 + +### Fixed + +- Ignored auth related hreaders for `login` and `change_password` resource + ## [2.6.0] - 2024-04-19 ### Added @@ -122,7 +128,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Initial Release -[unreleased]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.6.0...HEAD +[unreleased]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.6.1...HEAD +[2.6.1]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.6.0...2.6.1 [2.6.0]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.5.2...2.6.0 [2.5.2]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.5.1...2.5.2 [2.5.1]: https://github.com/netscaler/ansible-collection-netscaleradc/compare/2.5.0...2.5.1 diff --git a/galaxy.yml b/galaxy.yml index e14c97d94..7ca197e55 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -7,7 +7,7 @@ namespace: netscaler # The name of the collection. Has the same character restrictions as 'namespace' name: adc # The version of the collection. Must be compatible with semantic versioning -version: 2.6.0 +version: 2.6.1 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) diff --git a/plugins/module_utils/client.py b/plugins/module_utils/client.py index 95bdb73ab..f79ad4b1f 100644 --- a/plugins/module_utils/client.py +++ b/plugins/module_utils/client.py @@ -21,10 +21,11 @@ class NitroAPIClient(object): - def __init__(self, module): + def __init__(self, module, resource_name): self._module = module self.check_mode = module.check_mode # Dry run mode self.api_path = self._module.params.get("api_path") + self.resource_name = resource_name # Prepare the http headers according to module arguments self._headers = {} @@ -46,9 +47,13 @@ def __init__(self, module): elif have_userpass: self._headers["X-NITRO-USER"] = self._module.params["nitro_user"] self._headers["X-NITRO-PASS"] = self._module.params["nitro_pass"] + elif self.resource_name in {"login", "change_password"}: + # Do not set any authentication headers for the `login` resource + pass else: self._module.fail_json( - msg="Either `nitro_auth_token` or `nitro_user/nitro_pass` must be given for authentication" + msg="Either `nitro_auth_token` or `nitro_user/nitro_pass` must be given for authentication for the resource %s" + % self.resource_name ) # Do header manipulation when using NetScaler Console (ADM) as proxy diff --git a/plugins/module_utils/module_executor.py b/plugins/module_utils/module_executor.py index ffab81ae9..6c3c4eb08 100644 --- a/plugins/module_utils/module_executor.py +++ b/plugins/module_utils/module_executor.py @@ -132,7 +132,7 @@ def __init__(self, resource_name, supports_check_mode=True): }: self.module.params["api_path"] = "nitro/v2/config" - self.client = NitroAPIClient(self.module) + self.client = NitroAPIClient(self.module, self.resource_name) self.ns_major_version, self.ns_minor_version = get_netscaler_version( self.client )