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

Clean up /etc/hosts on ddev remove (remove unused hostnames) #831

Closed
peterkraume opened this issue May 7, 2018 · 7 comments
Closed

Clean up /etc/hosts on ddev remove (remove unused hostnames) #831

peterkraume opened this issue May 7, 2018 · 7 comments
Milestone

Comments

@peterkraume
Copy link
Sponsor Contributor

Feature request:

Please add some automatic cleanup to remove unused hostnames from /etc/hosts.
When you use a lot of projects or test a lot, the /etc/hosts gets cluttered with all the hostnames.
It would be great if ddev remove --remove-data would also remove the hostname from /etc/hosts.
Or maybe you want to introduce another flag that triggers the removal of unused hostnames.

@rfay
Copy link
Member

rfay commented May 9, 2018

I definitely agree, thanks for bringing this up.

@rfay rfay changed the title cleanup /etc/hosts on ddev remove Clean up /etc/hosts on ddev remove (remove unused hostnames) May 11, 2018
@rickmanelius
Copy link
Contributor

I suggest ddev hostname --clean-up.

@andrewfrench
Copy link
Contributor

I was poking around this issue last night and uncovered how the ddev hostname command is used internally to add hostnames, but doesn't provide support for removing hostnames, a prerequisite to cleaning up. Considering the v0 status, how do we feel about adding some explicit subcommands to ddev hostname?

  • sudo ddev hostname add mysite.ddev.local 127.0.0.1
  • sudo ddev hostname remove mysite.ddev.local 127.0.0.1
  • sudo ddev hostname cleanup

As a user, an "add this hostname" command implies an equal and opposite "remove this hostname" command, but that doesn't currently exist.

@rfay
Copy link
Member

rfay commented Jun 5, 2018

I'm good with this general approach @andrewfrench . It's all the easier since we rarely suggest that people actually use the ddev hostname directly.

@rickmanelius
Copy link
Contributor

👍 ddev hostname is largely something that end-users shouldn't need to muck with directly despite the fact that we expose it, so that approach is fine by me.

@beeradb
Copy link
Contributor

beeradb commented Jun 5, 2018

It's trivial to hide:
https://github.com/spf13/cobra/blob/master/command.go#L74-L75

Might not be desirable though, as it looks like we're adding more functionality to it.

@rickmanelius
Copy link
Contributor

@beeradb Yeah, I'm not super concerned about hiding it. Similar to import-files, even if 99% of users never use it, it is there and our top level command list isn't so large to be unwieldy (yet). So I would say leaving it visible for now is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants