2021-10-06 01:43:02 +00:00
|
|
|
From ccc75c1be3ae08d813193071c798fc905b5c03e5 Mon Sep 17 00:00:00 2001
|
2021-03-30 12:08:39 +00:00
|
|
|
From: Eduardo Otubo <otubo@redhat.com>
|
2021-10-06 01:43:02 +00:00
|
|
|
Date: Fri, 7 May 2021 13:36:12 +0200
|
2019-07-30 03:40:16 +00:00
|
|
|
Subject: DataSourceAzure.py: use hostnamectl to set hostname
|
|
|
|
|
|
|
|
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
|
Message-id: <20180417130754.12918-3-vkuznets@redhat.com>
|
|
|
|
Patchwork-id: 79659
|
|
|
|
O-Subject: [RHEL7.6/7.5.z cloud-init PATCH 2/2] DataSourceAzure.py: use hostnamectl to set hostname
|
|
|
|
Bugzilla: 1568717
|
|
|
|
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
|
|
|
|
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
|
|
|
|
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
|
|
|
|
|
|
|
The right way to set hostname in RHEL7 is:
|
|
|
|
|
|
|
|
$ hostnamectl set-hostname HOSTNAME
|
|
|
|
|
|
|
|
DataSourceAzure, however, uses:
|
|
|
|
$ hostname HOSTSNAME
|
|
|
|
|
|
|
|
instead and this causes problems. We can't simply change
|
|
|
|
'BUILTIN_DS_CONFIG' in DataSourceAzure.py as 'hostname' is being used
|
|
|
|
for both getting and setting the hostname.
|
|
|
|
|
|
|
|
Long term, this should be fixed in a different way. Cloud-init
|
|
|
|
has distro-specific hostname setting/getting (see
|
|
|
|
cloudinit/distros/rhel.py) and DataSourceAzure.py needs to be switched
|
|
|
|
to use these.
|
|
|
|
|
|
|
|
Resolves: rhbz#1434109
|
|
|
|
|
|
|
|
X-downstream-only: yes
|
|
|
|
|
2021-03-30 12:08:39 +00:00
|
|
|
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
|
2019-07-30 03:40:16 +00:00
|
|
|
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
|
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
|
---
|
|
|
|
cloudinit/sources/DataSourceAzure.py | 2 +-
|
|
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
|
2021-10-06 01:43:02 +00:00
|
|
|
index cee630f7..553b5a7e 100755
|
2019-07-30 03:40:16 +00:00
|
|
|
--- a/cloudinit/sources/DataSourceAzure.py
|
|
|
|
+++ b/cloudinit/sources/DataSourceAzure.py
|
2021-10-06 01:43:02 +00:00
|
|
|
@@ -296,7 +296,7 @@ def get_hostname(hostname_command='hostname'):
|
2019-07-30 03:40:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
def set_hostname(hostname, hostname_command='hostname'):
|
2021-03-30 12:08:39 +00:00
|
|
|
- subp.subp([hostname_command, hostname])
|
2019-07-30 03:40:16 +00:00
|
|
|
+ util.subp(['hostnamectl', 'set-hostname', str(hostname)])
|
|
|
|
|
|
|
|
|
2020-07-28 14:15:08 +00:00
|
|
|
@azure_ds_telemetry_reporter
|
2019-07-30 03:40:16 +00:00
|
|
|
--
|
2021-10-06 01:43:02 +00:00
|
|
|
2.27.0
|
2019-07-30 03:40:16 +00:00
|
|
|
|