python-hosts
python-hosts copied to clipboard
hosts.add with an entries list containing the same host twice should fail
Running the following program
from python_hosts import Hosts, HostsEntry
host = HostsEntry(
entry_type='ipv4',
address='10.10.10.10',
names=['samsung', 'samsung.local'],
)
entries = []
entries.append(host)
entries.append(host)
hosts = Hosts('testhosts')
hosts.add(entries, force=True)
hosts.write()
gives this content in testhosts
10.10.10.10 samsung samsung.local
10.10.10.10 samsung samsung.local
I would expect the entry to be present only once.
Thanks for the module. Saved me a lot of time.