Skip to content
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

hostctl adds entries for the same domain + ip #71

Closed
ddl-jbrown opened this issue Nov 19, 2020 · 3 comments
Closed

hostctl adds entries for the same domain + ip #71

ddl-jbrown opened this issue Nov 19, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ddl-jbrown
Copy link

ddl-jbrown commented Nov 19, 2020

Describe the bug
hostctl appears to not be idempotent when it adds entries for the same domain + ip when run multiple times.

To Reproduce
Run this command multiple times (--uniq doesn't seem to make a difference)

touch /tmp/test-hosts; hostctl add domains test domain1 --ip 127.0.0.1 --host-file /tmp/test-hosts

Current behavior

##################################################################
# Content under this line is handled by hostctl. DO NOT EDIT.
##################################################################

# profile.on test
127.0.0.1 domain1
127.0.0.1 domain1
127.0.0.1 domain1
127.0.0.1 domain1
# end

Expected behavior
When running the command above, /tmp/test-hosts should only contain one uniq entry.

Example of what it should look like

##################################################################
# Content under this line is handled by hostctl. DO NOT EDIT.
##################################################################

# profile.on test
127.0.0.1 domain1
# end

System (please complete the following information):

  • OS: Mac
  • Version: 10.15.7 (19H15)

Additional context

hostctl --version
hostctl version 1.0.14
@ddl-jbrown ddl-jbrown added the bug Something isn't working label Nov 19, 2020
@ddl-jbrown ddl-jbrown changed the title hostctl adds entries for the same domain + ip while the uniq flag is set hostctl adds entries for the same domain + ip Nov 20, 2020
@lukasmrtvy
Copy link

any progress on this ? thanks

@guumaster
Copy link
Owner

guumaster commented Jul 13, 2021

@ddl-jbrown thanks for bringing up this issue. I'm working on a solution with the --uniq param. But I'm thinking if it should always treat the pairs domain/ip as unique per profile as default. What do you think?

/cc @lukasmrtvy

@guumaster
Copy link
Owner

Fixed on release v1.1.0. Thanks for the feedback!

AlexErrant added a commit to AlexErrant/structured-text-tools that referenced this issue Apr 18, 2023
entires => entries

Source for idempotency change: guumaster/hostctl#71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants