jonhadfield / python-hosts

a hosts file manager library written in python
MIT License
125 stars 33 forks source link

allow_name_dupliction in Hosts.add() #51

Closed moonbuggy closed 4 months ago

moonbuggy commented 4 months ago

I've been using this module to automatically update dnsmasq from a Docker environment, over here: https://github.com/moonbuggy/docker-dnsmasq-updater

Now that it's swarm-capable, I want to be able to do round robin DNS.

It seems relatively trivial to add an _allow_nameduplication flag to Hosts.add(). Basically force without the _remove_allmatching() call.

I've tested the change in the dev branch of my project and it works as expected. It's possible I'm missing something, but it doesn't look like the change could impact any existing functionality.

Hopefully you'll agree it's a sensible thing to do and merge it so I don't need the override. :)

jonhadfield commented 4 months ago

Thanks for the PR. Will take a look on the weekend.

jonhadfield commented 4 months ago

LGTM. Many thanks.
Will try and push a release out today.

jonhadfield commented 4 months ago

Released. Thanks.

moonbuggy commented 4 months ago

Thanks for the rapid action. :) I wasn't expecting it to end up in a release so quickly, so it's a nice surprise to be able to do a module version bump and strip the override out of my code today.