-
Notifications
You must be signed in to change notification settings - Fork 61
DNS Resolver: Adding hosts should not delete what already exists #153
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
Comments
How do you remove hosts or domainoverrides then? I think we need an extra parameter to determine what the intent is - merge or strict definition. |
A PR would be great to work through this. |
The libvirt community module uses "flags" for some options. That might be reasonable to implement here.
I'm not sure if this is a reasonable approach or too complex. It might be too complex or out of style for this project however. Before I start working on a PR, I would love some input as to the way the author(s) think might be a reasonable approach. Should it be a completely different option? Should there be 2 options? What do you think |
I think we'll go with the suggestion from here: https://forum.ansible.com/t/how-best-to-express-desired-merged-or-replaced-state-for-module-that-accepts-a-list-of-items/39895 Let's have |
Thanks, I'll work on this and get back to you |
Surely we can just use the state: exists or state: removed attributes? |
I haven't forgotten about this, i just had #life happen |
no worries... I've been trying to get into writing more python... do you have a working branch that I could take a crack at on your fork? |
my fork is working yes. I have just been using my fork. However, my fork doesn't have the option requested. I changed the default behavior |
haha sorry by working branch I mean feature branch |
@stratus-ss Can you rebase and file a PR? |
@opoplawski I can but I haven't had time to work in your requested changes. Work has been very intense |
i'll see about writing some unit tests for this as well |
so i started to pick through the unit tests but really wasn't clear how they should work. Is there any documentation on this so I don't have to essentially reverse-engineer testing? @opoplawski |
I'm afraid there isn't any documentation at the moment. Hopefully looking at the tests for a simple module would be a good starting point. We generally have a separate initial simple xml config file for each - but it isn't even really necessary. |
I have updated my fork & branch, I added a new option similar to
It is confirmed working with the rebase. I will write some tests. They may not be in line with the current test style. We can adjust that after we have a test to base off of |
Is your feature request related to a problem? Please describe.
Currently when you use this module to add host entries, all previous entries are deleted and replaced with only the entries in the calling playbook. This behaviour is not ideal. You should have the option to retain current entries.
Describe the solution you'd like
There should be a clear delineated option to either overwrite or append to the host list.
Additional context
I believe this can be accomplished by modifying the
_params_to_obj()
method inpfsense_dns_resolver.py
and adding a helper function to determine what currently exists in the target pfsense host. The same can be done for domain overrides.I have hacked around on this and my working prototype looks like this
I'm happy to work a PR through, but I am not sure if this meets any requirements the project has.
#worksOnMyMachine
I have a commit in my fork which does the following:
The text was updated successfully, but these errors were encountered: