sources/azure: remove unnecessary hostname bounce#1143
Merged
Conversation
Thanks to [1], the hostname is set prior to network bring-up. The Azure data source has been bouncing the hostname during setup(), occurring after the hostname has already been properly configured. Note that this doesn't prevent leaking the image's hostname during Azure's _get_data() when it brings up ephemeral DHCP. However, as are not guaranteed to have the hostname metadata available from a truly "local" source, this behavior is to be expected unless we disable `send host-name` from dhclient config. canonical@133ad2c Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
39e7e57 to
6b4598f
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks to [1], the hostname is set prior to network bring-up.
The Azure data source has been bouncing the hostname during
setup(), occurring after the hostname has already been
properly configured.
Note that this doesn't prevent leaking the image's hostname
during Azure's _get_data() when it brings up ephemeral DHCP.
However, as are not guaranteed to have the hostname metadata
available from a truly "local" source, this behavior is to
be expected unless we disable
send host-namefrom dhclientconfig.
133ad2c
Signed-off-by: Chris Patterson cpatterson@microsoft.com
Additional Context
This behavior be seen easily enough by launching an Ubuntu 20.04 VM on Azure.
grep -i hostname /var/log/cloud-init.log
2021-12-09 17:16:25,706 - DataSourceAzure.py[DEBUG]: Hostname retrieved from IMDS: cpatterson-u20-x1
2021-12-09 17:16:26,093 - cc_set_hostname.py[DEBUG]: Setting the hostname to cpatterson-u20-x1 (cpatterson-u20-x1)
2021-12-09 17:16:26,093 - util.py[DEBUG]: Reading from /etc/hostname (quiet=False)
2021-12-09 17:16:26,093 - util.py[DEBUG]: Read 7 bytes from /etc/hostname
2021-12-09 17:16:26,093 - util.py[DEBUG]: Writing to /etc/hostname - wb: [644] 18 bytes
2021-12-09 17:16:26,093 - init.py[DEBUG]: Non-persistently setting the system hostname to cpatterson-u20-x1
2021-12-09 17:16:26,094 - subp.py[DEBUG]: Running command ['hostname', 'cpatterson-u20-x1'] with allowed return codes [0] (shell=False, capture=True)
2021-12-09 17:16:26,096 - atomic_helper.py[DEBUG]: Atomically writing to file /var/lib/cloud/data/set-hostname (via temporary file /var/lib/cloud/data/tmp8t_8f9ws) - w: [644] 67 bytes/chars
2021-12-09 17:16:28,658 - handlers.py[DEBUG]: start: azure-ds/bounce_network_with_azure_hostname: bounce_network_with_azure_hostname
2021-12-09 17:16:28,658 - DataSourceAzure.py[DEBUG]: Hostname in metadata is cpatterson-u20-x1
2021-12-09 17:16:28,658 - handlers.py[DEBUG]: start: azure-ds/temporary_hostname: temporary_hostname
2021-12-09 17:16:28,658 - handlers.py[DEBUG]: finish: azure-ds/temporary_hostname: SUCCESS: temporary_hostname
2021-12-09 17:16:28,658 - subp.py[DEBUG]: Running command ('hostname',) with allowed return codes [0] (shell=False, capture=True)
2021-12-09 17:16:28,662 - handlers.py[DEBUG]: finish: azure-ds/bounce_network_with_azure_hostname: SUCCESS: bounce_network_with_azure_hostname
Checklist: