-
Notifications
You must be signed in to change notification settings - Fork 883
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
docs: add create_hostname_file to all hostname user-data examples #4727
docs: add create_hostname_file to all hostname user-data examples #4727
Conversation
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.
Thanks @catmsred for this PR. I like the direction of it. I just noticed the WIP tag, but I had already started reviewing so I'll leave what I started below.
Think we want to add this to the modules examples?
@@ -287,6 +287,9 @@ On an Ubuntu system, :file:`/etc/cloud/cloud.cfg` should look similar to: | |||
# This will cause the set+update hostname module to not operate (if true) | |||
preserve_hostname: false | |||
|
|||
# This will create the hostname file (e.g. /etc/hostname) if it does not already exist (if true) | |||
create_hostname_file: false |
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.
Why add this?
On an Ubuntu system, :file:
/etc/cloud/cloud.cfg
should look similar to:
This will only be true on GCE, right?
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.
Good point -- will fix! And yes, I think it would be good to add to the modules examples for set and update hostname. Thanks!
bff03b9
to
b136c51
Compare
@@ -216,6 +216,7 @@ Example ``meta-data`` | |||
broadcast 192.168.1.255 | |||
gateway 192.168.1.254 | |||
hostname: myhost | |||
create_hostname_file: true |
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.
create_hostname_file
isn't valid here. This is meta data, not user data
@@ -338,6 +338,7 @@ this datasource using the GuestInfo keys transport: | |||
|
|||
instance-id: cloud-vm | |||
local-hostname: cloud-vm | |||
create_hostname_file: true |
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.
This key is not valid here. We instead add it to the user data in the block below this one.
doc/rtd/tutorial/qemu-script.sh
Outdated
@@ -22,6 +22,7 @@ EOF | |||
cat << EOF > meta-data | |||
instance-id: someid/somehostname | |||
local-hostname: jammy | |||
create_hostname_file: true |
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.
Since this is a tutorial, I think we can remove this line (and probably the line above it) to avoid over-complicating things.
@holmanb , what do you think? Also...where is this file even used/referenced?
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.
Since this is a tutorial, I think we can remove this line (and probably the line above it) to avoid over-complicating things.
+1 works for me
Also...where is this file even used/referenced?
This file is referenced from the Qemu tutorial debugging page.
doc/rtd/tutorial/qemu.rst
Outdated
@@ -144,6 +144,7 @@ Now let's run the following command, which creates a file named | |||
$ cat << EOF > meta-data | |||
instance-id: someid/somehostname | |||
local-hostname: jammy | |||
create_hostname_file: true |
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.
Same here. This would go into user data, not meta data. Though...I'm not sure it's worth mentioning hostnames at all.
0d5d178
to
dc56887
Compare
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.
LGTM!
@catmsred , I'm assuming this is no longer WIP? If so, it's usually best to remove WIP from the title.
I don't consider it still a WIP but I would like @s-makin to finish her review before it's merged |
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.
@holmanb I don't think anyone has validated the NoCloud reference example change starting from the beginning of the example, but if you're okay with merging that I'm fine with it too. |
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.
Just a few nits. The tutorial still runs fine, so no problems there, but I did have problems getting tox - doc to run. Some sort of a problem with the pyspelling module?
cloudinit/config/cc_set_hostname.py
Outdated
dedent( | ||
"""\ | ||
# On a machine without an ``/etc/hostname`` file, don't create it | ||
# In most clouds, this will results in a DHCP configured hostname |
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.
# In most clouds, this will results in a DHCP configured hostname | |
# In most clouds, this will result in a DHCP-configured hostname |
dedent( | ||
"""\ | ||
# On a machine without an ``/etc/hostname`` file, don't create it | ||
# In most clouds, this will results in a DHCP configured hostname |
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.
# In most clouds, this will results in a DHCP configured hostname | |
# In most clouds, this will result in a DHCP-configured hostname |
If a cloud or user sets create_hostname_file to false (as GCP does) the examples in our docs for setting the hostname will not work. This change updates those examples to also set create_hostname_file to true.
Co-authored-by: James Falcon <therealfalcon@gmail.com>
dc56887
to
38ba64e
Compare
If a cloud or user sets create_hostname_file to false (as GCP does) the examples in our docs for setting the hostname will not work. This change updates those examples to also set create_hostname_file to true.
Proposed Commit Message
Additional Context
See #4330 for details on
create_hostname_file
key.Test Steps
This is left as a WIP because I want to go through and follow each of the changed examples to ensure they still work with the new key included.
Checklist
Merge type