diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-04-20 15:41:22 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-04-20 15:41:22 +0200 |
commit | eb8943a0fe2d37bb981573361e56b28511844503 (patch) | |
tree | addc8ba228bcb82498752b192b04c816dd61ff7f /src | |
parent | fc354d633d6dc64472cc54acef21b80934e0065c (diff) | |
download | vyos-1x-eb8943a0fe2d37bb981573361e56b28511844503.tar.gz vyos-1x-eb8943a0fe2d37bb981573361e56b28511844503.zip |
[hostname] T1336: sanitize FQDN before passing to hostnamectl
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/host_name.py | 3 |
1 files changed, 2 insertions, 1 deletions
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") |