From eb8943a0fe2d37bb981573361e56b28511844503 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 20 Apr 2019 15:41:22 +0200 Subject: [hostname] T1336: sanitize FQDN before passing to hostnamectl --- src/conf_mode/host_name.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/conf_mode/host_name.py') diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py index 030735215..32ae4526f 100755 --- a/src/conf_mode/host_name.py +++ b/src/conf_mode/host_name.py @@ -98,7 +98,8 @@ def generate(config): def apply(config): """Apply configuration""" - os.system("hostnamectl set-hostname --static {0}".format(config["fqdn"])) + fqdn = config["fqdn"] + os.system("hostnamectl set-hostname --static {0}".format(fqdn.rstrip('.'))) # Restart services that use the hostname os.system("systemctl restart rsyslog.service") -- cgit v1.2.3