Skip to content

Commit

Permalink
Merge pull request #426 from netscaler/ignore-headers-for-login-resource
Browse files Browse the repository at this point in the history
ignored auth headers for login resource
  • Loading branch information
sumanth-lingappa authored Apr 29, 2024
2 parents ddf000a + af5bd70 commit 9b850f5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <email> (url)
Expand Down
9 changes: 7 additions & 2 deletions plugins/module_utils/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/module_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 9b850f5

Please sign in to comment.