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

Fix Gentoo hostname bug #611

Merged
merged 3 commits into from
Oct 27, 2020
Merged

Conversation

manuelisimo
Copy link
Contributor

Gentoo's hostname file format instead of being just the host name by itself is hostname="thename". The existing code works fine when the file has no comments but if there is a comment, then the line:

gentoo_hostname_config = 'hostname="%s"' % conf

can render an invalid hostname file that looks similar to

hostname="#This is the host namehello"

The fix calls set_hostname with the parameter in a gentoo friendly way so that it gets handled by HostnameConf as a whole, and comments are handled and preserved

Copy link
Contributor

@otubo otubo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does look good to me.

Gentoo's hostname file format instead of being just the host name
is hostname=thename". The old code works fine when the file has no comments
but if there is a comment the line

```
gentoo_hostname_config = 'hostname="%s"' % conf
```

can render an invalid hostname file that looks similar to

```
hostname="#This is the host namehello"
```

The fix inserts the hostname in a gentoo friendly way so that it gets
handled by HostnameConf as a whole and comments are handled and preserved
@manuelisimo
Copy link
Contributor Author

Re-based branch and fixed flake8 issue

Copy link
Collaborator

@OddBloke OddBloke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@@ -13,6 +13,7 @@ johnsonshi
jqueuniet
landon912
lucasmoura
manuelisimo
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've confirmed this signature internally, thanks!


# Many distro's format is the hostname by itself, and that is the
# way HostnameConf works but gentoo expects it to be in
# hostname="the-actual-hostname"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OddBloke OddBloke merged commit b8bd081 into canonical:master Oct 27, 2020
This was referenced May 12, 2023
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

Successfully merging this pull request may close these issues.

None yet

4 participants