Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignored auth headers for login resource #426

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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