summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2019-06-18 16:08:08 +0200
committerKim Hagen <kim.sidney@gmail.com>2019-06-18 16:08:08 +0200
commit0037287a8e6a7ddd6d4a8101804d9cc0b8b3e70f (patch)
tree4093cb0095db8c6ea5c3497094b110ca37e6b508
parent73021645d1d1fa0e851bae7e003982f9ee491e84 (diff)
downloadvyos-1x-0037287a8e6a7ddd6d4a8101804d9cc0b8b3e70f.tar.gz
vyos-1x-0037287a8e6a7ddd6d4a8101804d9cc0b8b3e70f.zip
[ config ] T1447: Python subprocess called without import in host_name.py
-rwxr-xr-xsrc/conf_mode/host_name.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py
index 0d03fd41c..13b2b98ae 100755
--- a/src/conf_mode/host_name.py
+++ b/src/conf_mode/host_name.py
@@ -25,6 +25,7 @@ import re
import sys
import copy
import glob
+import subprocess
import argparse
import jinja2
@@ -250,13 +251,13 @@ def apply(config):
# rsyslog runs into a race condition at boot time with systemd
# restart rsyslog only if the hostname changed.
- hn = subprocess.check_output(['hostnamectl','--static']).decode().strip()
+ hn = subprocess.check_output(['hostnamectl', '--static']).decode().strip()
os.system("hostnamectl set-hostname --static {0}".format(fqdn.rstrip('.')))
# Restart services that use the hostname
if hn != fqdn:
- os.system("systemctl restart rsyslog.service")
+ os.system("systemctl restart rsyslog.service")
# If SNMP is running, restart it too
if os.system("pgrep snmpd > /dev/null") == 0: