Skip to content

hosts.add with an entries list containing the same host twice should fail #54

@paulbusse

Description

@paulbusse

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions