-
Notifications
You must be signed in to change notification settings - Fork 909
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
Add an option for rhel to force the use of hostname config #859
Conversation
9d1b7bc
to
dffb162
Compare
RHEL always use the FQDN as hostname thats the default behavior, adding the config rhel_use_hostname will force RHEL to use the hostname if sent LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, adding the config rhel_use_hostname will force RHEL to use the hostname if sent as hostname for instance LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, adding the config rhel_use_hostname will force RHEL to use the hostname if sent LP: canonical#859
Hi @hamalq , I think if we had a distro-independent setting along the lines of @OddBloke , do you have strong opinions here? I'm hesitant about adding a new top-level key, but given how things currently work, I'm not really sure there's a better way to allow this. |
I strongly agree that we should name it independent of distro. We have been trying to avoid introducing new top-level keys, as you say: given that we already use the
Stepping back, actually, might it be easier to express this as a more explicit boolean: |
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
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.
Thank you for the branch @hamalq in order to land this I think we need to minmally extend unittests which cover these affected behaviors in
Also it would be nice to extend the integration test below with a sample #coud-config which provides this new key
tests/integration_tests/modules/test_set_hostname.py
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
RHEL always use the FQDN as hostname thats the default behavior, setting prefer_fqdn_over_hostname option to to false will prefer the hostname over fqdn for the other distros the option prefer_fqdn_over_hostname will default to false since the default behavior is using the hostname, if set true the fqdn will be used LP: canonical#859
the above option allow the user to control the behavior of a distro hostname selection so if the user send hostname, FQDN Configs if prefer_fqdn_over_hostname is true the The FQDN will be selected as hostname if false the hostname will be selected LP: canonical#859
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.
I think what remains is documentation of this feature. I'm testing locally now to confirm behavior and double checking the need for distro.set_option
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.
I confirm that this approach is the best we have at the moment. distro class has no visibility to the merged sys_cfg which contains user-data cloud-config settings (which the datasource instances have). I was under the impression we might be able to get to it thourgh distro._cfg but that's a different subset of config entirely.
confirmed that hostnames are properly set on this new version cloud-init.
the above option allow the user to control the behavior of a distro hostname selection so if the user send hostname, FQDN Configs if prefer_fqdn_over_hostname is true the The FQDN will be selected as hostname if false the hostname will be selected LP: canonical#859
the above option allow the user to control the behavior of a distro hostname selection so if the user send hostname, FQDN Configs if prefer_fqdn_over_hostname is true the The FQDN will be selected as hostname if false the hostname will be selected LP: canonical#859
the above option allow the user to control the behavior of a distro hostname selection so if the user send hostname, FQDN Configs if prefer_fqdn_over_hostname is true the The FQDN will be selected as hostname if false the hostname will be selected LP: canonical#859
the above option allow the user to control the behavior of a distro hostname selection so if the user send hostname, FQDN Configs if prefer_fqdn_over_hostname is true the The FQDN will be selected as hostname if false the hostname will be selected LP: canonical#859
the above option allow the user to control the behavior of a distro hostname selection so if the user send hostname, FQDN Configs if prefer_fqdn_over_hostname is true the The FQDN will be selected as hostname if false the hostname will be selected LP: canonical#859
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.
Looks good to me! I took the liberty of pushing a couple small changes:
- The same doc update you made to cc_set_hostname.py was also needed in cc_update_hostname.py
- Added an integration test for when prefer_fqdn_over_hostname is false
- Updated some unit tests to include both hostname and fqdn to make sure we're always choosing the right one
- Also updated some unit tests to not skip their verification if we're on a systemd system.
Assuming CI passes, I should be able to get this merged later today.
the above option allow the user to control the behavior of a distro hostname selection so if the user send hostname, FQDN Configs if prefer_fqdn_over_hostname is true the The FQDN will be selected as hostname if false the hostname will be selected LP: canonical#859
f26b066
to
c15611a
Compare
c15611a
to
6ed8817
Compare
LP: #1921004
Proposed Commit Message
Additional Context
Test Steps
Checklist: