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

nios_a_record fails when using environment variables for provider data #255

Open
murrahjm opened this issue Sep 10, 2024 · 1 comment
Open

Comments

@murrahjm
Copy link

murrahjm commented Sep 10, 2024

Given the following sample code:

infoblox.nios.nios_a_record:
  name: testrecord.domain.com
  view: default
  ipv4addr: 10.10.10.10

with the following environment variables set:

INFOBLOX_HOST
INFOBLOX_USERNAME
INFOBLOX_PASSWORD

the task fails with this error:

"ansible.module_utils.api.get_connector() argument after ** must be a mapping, not NoneType"

I think it's referencing this line:

self.connector = get_connector(**provider)

@murrahjm
Copy link
Author

Just playing around I was able to fix this by changing this line:

self.connector = get_connector(**provider)

to this:

self.connector = get_connector(**(provider or {}))

basically allowing an empty value to get passed, which will then be populated with the NIOS_PROVIDER_SPEC (unless provider is explicitly passed, in which case it will use that)

My python isn't great so I have no idea if this is the correct way to fix it, but I tested it in my environment and it seemed to function at least with the nios_a_record module. Happy to do a pull request is this is valid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant