Skip to content

Commit

Permalink
Add an option for rhel to force the use of hostname config
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hamzah alqtaishat authored and hamalq committed Mar 30, 2021
1 parent 3b7e2e8 commit 73eb362
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cloudinit/distros/rhel.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def _write_hostname(self, hostname, out_fn):
def _select_hostname(self, hostname, fqdn):
# Should be fqdn if we can use it
# See: https://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-sysconfig.html#s2-sysconfig-network # noqa
if util.get_cfg_option_bool(self._cfg, "rhel_use_hostname", False) \
and hostname:
return hostname
if fqdn:
return fqdn
return hostname
Expand Down

0 comments on commit 73eb362

Please sign in to comment.