summaryrefslogtreecommitdiff
path: root/src/conf_mode/system_host-name.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-02-05 20:23:44 +0100
committerGitHub <noreply@github.com>2025-02-05 20:23:44 +0100
commitc40ff64dfcdbd9c597b686952769df9c106967cd (patch)
treeaf10da96ef3dcc44149c9bdb9ab20ea1df7bbe24 /src/conf_mode/system_host-name.py
parentc1cd7b4a7665f29ffcbe22d8450abaa759932242 (diff)
parentcf7721f7d5345e484e0c57b643913d2353dca6f5 (diff)
downloadvyos-1x-c40ff64dfcdbd9c597b686952769df9c106967cd.tar.gz
vyos-1x-c40ff64dfcdbd9c597b686952769df9c106967cd.zip
Merge pull request #4305 from c-po/syslog-T6989
syslog: T6989: convert old configuration format to "advanced"
Diffstat (limited to 'src/conf_mode/system_host-name.py')
-rwxr-xr-xsrc/conf_mode/system_host-name.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/conf_mode/system_host-name.py b/src/conf_mode/system_host-name.py
index 3f245f166..fef034d1c 100755
--- a/src/conf_mode/system_host-name.py
+++ b/src/conf_mode/system_host-name.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018-2024 VyOS maintainers and contributors
+# Copyright (C) 2018-2025 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -23,6 +23,7 @@ import vyos.hostsd_client
from vyos.base import Warning
from vyos.config import Config
from vyos.configdict import leaf_node_changed
+from vyos.defaults import systemd_services
from vyos.ifconfig import Section
from vyos.template import is_ip
from vyos.utils.process import cmd
@@ -174,11 +175,13 @@ def apply(config):
# Restart services that use the hostname
if hostname_new != hostname_old:
- call("systemctl restart rsyslog.service")
+ tmp = systemd_services['rsyslog']
+ call(f'systemctl restart {tmp}')
# If SNMP is running, restart it too
if process_named_running('snmpd') and config['snmpd_restart_reqired']:
- call('systemctl restart snmpd.service')
+ tmp = systemd_services['snmpd']
+ call(f'systemctl restart {tmp}')
return None