|
|
936480 |
From 0d66b31973a4934b2019ff7df37087e2f427f6fd Mon Sep 17 00:00:00 2001
|
|
|
936480 |
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
936480 |
Date: Tue, 17 Apr 2018 13:07:54 +0200
|
|
|
936480 |
Subject: DataSourceAzure.py: use hostnamectl to set hostname
|
|
|
936480 |
|
|
|
936480 |
RH-Author: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
936480 |
Message-id: <20180417130754.12918-3-vkuznets@redhat.com>
|
|
|
936480 |
Patchwork-id: 79659
|
|
|
936480 |
O-Subject: [RHEL7.6/7.5.z cloud-init PATCH 2/2] DataSourceAzure.py: use hostnamectl to set hostname
|
|
|
936480 |
Bugzilla: 1568717
|
|
|
936480 |
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
|
|
|
936480 |
RH-Acked-by: Mohammed Gamal <mgamal@redhat.com>
|
|
|
936480 |
RH-Acked-by: Cathy Avery <cavery@redhat.com>
|
|
|
936480 |
|
|
|
936480 |
The right way to set hostname in RHEL7 is:
|
|
|
936480 |
|
|
|
936480 |
$ hostnamectl set-hostname HOSTNAME
|
|
|
936480 |
|
|
|
936480 |
DataSourceAzure, however, uses:
|
|
|
936480 |
$ hostname HOSTSNAME
|
|
|
936480 |
|
|
|
936480 |
instead and this causes problems. We can't simply change
|
|
|
936480 |
'BUILTIN_DS_CONFIG' in DataSourceAzure.py as 'hostname' is being used
|
|
|
936480 |
for both getting and setting the hostname.
|
|
|
936480 |
|
|
|
936480 |
Long term, this should be fixed in a different way. Cloud-init
|
|
|
936480 |
has distro-specific hostname setting/getting (see
|
|
|
936480 |
cloudinit/distros/rhel.py) and DataSourceAzure.py needs to be switched
|
|
|
936480 |
to use these.
|
|
|
936480 |
|
|
|
936480 |
Resolves: rhbz#1434109
|
|
|
936480 |
|
|
|
936480 |
X-downstream-only: yes
|
|
|
936480 |
|
|
|
936480 |
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
936480 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
936480 |
---
|
|
|
936480 |
cloudinit/sources/DataSourceAzure.py | 2 +-
|
|
|
936480 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
936480 |
|
|
|
936480 |
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
|
|
|
936480 |
index e076d5d..7dbeb04 100644
|
|
|
936480 |
--- a/cloudinit/sources/DataSourceAzure.py
|
|
|
936480 |
+++ b/cloudinit/sources/DataSourceAzure.py
|
|
|
936480 |
@@ -238,7 +238,7 @@ def get_hostname(hostname_command='hostname'):
|
|
|
936480 |
|
|
|
936480 |
|
|
|
936480 |
def set_hostname(hostname, hostname_command='hostname'):
|
|
|
936480 |
- util.subp([hostname_command, hostname])
|
|
|
936480 |
+ util.subp(['hostnamectl', 'set-hostname', str(hostname)])
|
|
|
936480 |
|
|
|
936480 |
|
|
|
936480 |
@contextlib.contextmanager
|
|
|
936480 |
--
|
|
|
936480 |
1.8.3.1
|
|
|
936480 |
|