jonhadfield / python-hosts

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

Issue when forcing update via link #8

Closed sruslanas closed 7 years ago

sruslanas commented 7 years ago

Hi,

I have started using this module and overall it is pretty usefull, but I miss one function or maybe I am just using it in incorrect way. I have a file with records, that is updated often. i.e. 1.2.3.4 one.example.com two.example.com

When record in file changes, I expect that records would be updated, 1.2.3.4 one.example.com

Using the code below it never happens and two.example.com is never removed, even remote file is updated

hosts_path.import_url(url='https://dl.dropboxusercontent.com/s/nfivpnt39vua05v/hosts?dl=0',force=True)
hosts_path.write()

However if we I try to use for same scenario below code, it is working fine.

new_entry = HostsEntry(entry_type='ipv4', address='1.2.3.4', names=['one.example.com','two.example.com'])
hosts_path.add([new_entry],force=True)
hosts_path.write()

Could be there some bug or I am doing wrong, when passing file via link?

jonhadfield commented 7 years ago

Hi @SMINT, there was no 'force' option for release 0.3.6, so I've just added it and pushed new release 0.3.7 to pypi.

jonhadfield commented 7 years ago

Closing, but please shout if this hasn't solved your issue.