summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-12-31 13:41:29 +0100
committerDaniil Baturin <daniil@baturin.org>2018-12-31 13:41:29 +0100
commitd50524722819582cc1d7ad289d12e9f585f701de (patch)
tree9dd65472ef43a31530ee77cb5aed66565ef81b6c
parent432d98347ab3fbb737796081e122b6c69a3bbb8f (diff)
downloadvyos-1x-d50524722819582cc1d7ad289d12e9f585f701de.tar.gz
vyos-1x-d50524722819582cc1d7ad289d12e9f585f701de.zip
T1128: restart SNMP on hostname change.
-rw-r--r--debian/control1
-rwxr-xr-xsrc/conf_mode/host_name.py6
2 files changed, 6 insertions, 1 deletions
diff --git a/debian/control b/debian/control
index 7061d50ef..93608d888 100644
--- a/debian/control
+++ b/debian/control
@@ -35,6 +35,7 @@ Depends: python3,
lsscsi,
pciutils,
usbutils,
+ procps,
snmp, snmpd,
openssh-server,
ntp,
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index 3b3958f7f..030735215 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -100,9 +100,13 @@ def apply(config):
"""Apply configuration"""
os.system("hostnamectl set-hostname --static {0}".format(config["fqdn"]))
- # restart services that use the hostname
+ # Restart services that use the hostname
os.system("systemctl restart rsyslog.service")
+ # If SNMP is running, restart it too
+ if os.system("pgrep snmpd > /dev/null") == 0:
+ os.system("systemctl restart snmpd.service")
+
return None