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

Add support for specifying -4 option to nsupdate #42

Merged
merged 1 commit into from
Jul 14, 2022

Conversation

accorvin
Copy link
Contributor

In our environment, our DNS server requires passing the "-4" argument to
the nsupdate command. This change adds support for configuring OSIA to
use this option when using the nsupdate dns provider.

@accorvin
Copy link
Contributor Author

@mijaros can I get your thoughts on this?

@mijaros
Copy link
Contributor

mijaros commented Jul 14, 2022

@accorvin this is certainly a good idea and thank you for the contribution, we might add a dns option to enforce this, if you'd agree, something like --dns-use-ipv4 and default option to settings.yml to the dns part?

@accorvin
Copy link
Contributor Author

@mijaros that makes sense to me. I can work on updating this PR to do that.

@mijaros
Copy link
Contributor

mijaros commented Jul 14, 2022

@accorvin if you can I'd be grateful. Thank you.
I think that it should be enough to add the option to the ARGUMENTS list in

'dns': {

with 'action': 'store_true'and rename the __init__ argument in NSUpdate class to the same name (without the dns_ prefix), so in the situation above it would be use_ipv4=False for argument dns_use_ipv4.

@accorvin
Copy link
Contributor Author

accorvin commented Jul 14, 2022

@mijaros Updated. Let me know what you think.

Copy link
Contributor

@mijaros mijaros left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blimey, store_true won't work together with dynaconf in the current setup. The problem is that the store_true action always defaults to false. The way how the overriding from command line now works with osia is, that if the key in command line arguments is not None it means we're overriding anything that's in the settings.yaml. Since store_true always keeps the key in the arguments, it basically overrides all the time. I've found a potential workaround, to use store_const (see suggested change) with the value of True. This will mean, that if the option is not passed it will have a value of None and if it is passed, it will have the value of True. Hence it can be stored in the settings.yaml as well as overridden from the command line if needed.

@mijaros
Copy link
Contributor

mijaros commented Jul 14, 2022

@accorvin ok it seems that now it's only the linter complaining, could I ask you to rearrange the code (it will only be necessary to add a line and align it in cli.py). Then you can run the following command

poetry run flake8 osia --max-line-length 100 --show-source --statistics

and it should be clean.
As the last thing, I'd ask you to squash all of those commits, please (and maybe rebase). After that, I think we're ready to merge and test/release.

In our environment, our DNS server requires passing the "-4" argument to
the nsupdate command. This change adds support for configuring OSIA to
use this option when using the nsupdate dns provider.
@accorvin accorvin force-pushed the nsupdate-ipv4 branch 2 times, most recently from 8243000 to 911e62b Compare July 14, 2022 18:45
@accorvin
Copy link
Contributor Author

@mijaros done

@mijaros
Copy link
Contributor

mijaros commented Jul 14, 2022

I've tried it, and the option works as well as the configuration in settings.yaml. Going to merge now, and then release.

@accorvin
Copy link
Contributor Author

Awesome! Thanks for the quick turnaround @mijaros!

@mijaros mijaros merged commit 911e62b into redhat-cop:master Jul 14, 2022
@zdtsw
Copy link

zdtsw commented Feb 27, 2023

Bumped into this flag "--dns-use-ipv4" when trying to provision from my local RHEL8 then realized nsupdate does not support "-4" (seems the same case as on Mac) but on F37 it works.

Thinking if it is a good idea to add check logic in the script, say, when user uses this flag, it still checks to see if installed nsupdate work fine? if not, then set nsupdate_args.append('') even the flag is supplied.

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

Successfully merging this pull request may close these issues.

3 participants