summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-04-20 15:32:30 +0200
committerChristian Poessinger <christian@poessinger.com>2019-04-20 15:32:30 +0200
commit27c4afd725a3024f72fafc11bd1d5b88bbbeabe9 (patch)
tree9640c6bc3a35b0d13cfbef0a58768ed6e3ffb6b1 /src/conf_mode
parent7681f586860bb4ad22f5b83fb6144a13556954c4 (diff)
downloadvyos-1x-27c4afd725a3024f72fafc11bd1d5b88bbbeabe9.tar.gz
vyos-1x-27c4afd725a3024f72fafc11bd1d5b88bbbeabe9.zip
[hostname] T1336: sanitize FQDN before passing to hostnamectl
Remove possible trialing (.) when invoking hostnamectl. A hostname with a trailing (.) is not supported in hostnamectl.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/host_name.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index b0972a8f1..81a52e87f 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -237,7 +237,7 @@ def apply(config):
if config['domain_name']:
fqdn += '.' + config['domain_name']
- os.system("hostnamectl set-hostname --static {0}".format(fqdn))
+ os.system("hostnamectl set-hostname --static {0}".format(fqdn.rstrip('.')))
# Restart services that use the hostname
os.system("systemctl restart rsyslog.service")
@@ -245,7 +245,7 @@ def apply(config):
# If SNMP is running, restart it too
if os.system("pgrep snmpd > /dev/null") == 0:
os.system("systemctl restart snmpd.service")
-
+
# restart pdns if it is used
if os.system("/usr/bin/rec_control ping >/dev/null 2>&1") == 0:
os.system("/etc/init.d/pdns-recursor restart >/dev/null")