summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Klausen <kristian@klausen.dk>2021-02-25 17:12:17 +0100
committerGitHub <noreply@github.com>2021-02-25 11:12:17 -0500
commit2757333e844f597b85980093bddc52552ef73aa5 (patch)
tree1328efe3dd111879bc714f112d6996d75d04a2d9
parent402d98edaa3a266bd5fab2b3a10d716346da6eb9 (diff)
downloadcloud-init-git-2757333e844f597b85980093bddc52552ef73aa5.tar.gz
archlinux: Use hostnamectl to set the transient hostname (#797)
hostname (inetutils) isn't installed per default on arch, so switch to hostnamectl which is installed per default (systemd).
-rw-r--r--cloudinit/distros/arch.py11
-rw-r--r--tools/.github-cla-signers1
2 files changed, 12 insertions, 0 deletions
diff --git a/cloudinit/distros/arch.py b/cloudinit/distros/arch.py
index 378a6daa..5f42a24c 100644
--- a/cloudinit/distros/arch.py
+++ b/cloudinit/distros/arch.py
@@ -137,6 +137,17 @@ class Distro(distros.Distro):
return default
return hostname
+ # hostname (inetutils) isn't installed per default on arch, so we use
+ # hostnamectl which is installed per default (systemd).
+ def _apply_hostname(self, hostname):
+ LOG.debug("Non-persistently setting the system hostname to %s",
+ hostname)
+ try:
+ subp.subp(['hostnamectl', '--transient', 'set-hostname', hostname])
+ except subp.ProcessExecutionError:
+ util.logexc(LOG, "Failed to non-persistently adjust the system "
+ "hostname to %s", hostname)
+
def set_timezone(self, tz):
distros.set_etc_timezone(tz=tz, tz_file=self._find_tz_file(tz))
diff --git a/tools/.github-cla-signers b/tools/.github-cla-signers
index 5dfa2eb3..aca0ee5e 100644
--- a/tools/.github-cla-signers
+++ b/tools/.github-cla-signers
@@ -20,6 +20,7 @@ johnsonshi
jordimassaguerpla
jqueuniet
jsf9k
+klausenbusk
landon912
lucasmoura
lungj