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
fix: handle wildcard hostnames when name resolution not available, fixes #4881 #6025
Conversation
Download the artifacts for this pull request:
See Testing a PR. |
pkg/ddevapp/hostname_mgt.go
Outdated
if err != nil { | ||
return err | ||
if strings.Contains(name, `*`) { | ||
util.Warning("DDEV cannot add unresolvable wildcard hostnames like `%s` to your hosts file", name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this also point to docs or mention that there are probably ways to resolve this? The message is completely true, but still makes me think I misconfigured the project rather than having a general networking issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added link to new doc.
Co-authored-by: Stanislav Zhuk <stasadev@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, works fine, no sudo for unresolvable hostnames.
A little confusion with:
ddev start
...
Successfully started d10
Project can be reached at https://d10.ddev.site https://*.junk.ddev.site https://127.0.0.1:32774
https://*.junk.ddev.site
is added to the list of hostnames anyway.
I thought about moving the warning to app.GetHostnames()
, but that's probably not the best idea because it's used in so many places.
And hiding it in pkg/ddevapp/hostname_mgt.go
doesn't hide it when running ddev describe
or when checking the value of $DDEV_HOSTNAME
.
Either way, I'm fine with this PR, the user is informed of the problem and has to solve it on their own.
The Issue
additional_hostnames
prompts for admin privileges #4881There are a few problems with creating hostnames in /etc/hosts when name lookup fails.
How This PR Solves The Issue
Tell when we can't do it and don't try doing it.
Manual Testing Instructions
You should get a warning that
*.junk.ddev.site
can't be added to hosts file... because hosts file doesn't do wildcards.Release/Deployment Notes