Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

archlinux: Use hostnamectl to set the transient hostname #797

Merged
merged 3 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cloudinit/distros/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ def _read_hostname(self, filename, default=None):
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:
klausenbusk marked this conversation as resolved.
Show resolved Hide resolved
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))

Expand Down
1 change: 1 addition & 0 deletions tools/.github-cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ johnsonshi
jordimassaguerpla
jqueuniet
jsf9k
klausenbusk
landon912
lucasmoura
lungj
Expand Down