summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-08-30 22:51:55 +0200
committerChristian Poessinger <christian@poessinger.com>2019-08-30 22:51:55 +0200
commit13fb3d9da7bb61dcd593c440ae798fd75474ebed (patch)
treebf93362625a58e32aa63cd87de8f8530f677dbfe /python
parentf8aab22927274ab6ba210be946b368f27ee75582 (diff)
downloadvyos-1x-13fb3d9da7bb61dcd593c440ae798fd75474ebed.tar.gz
vyos-1x-13fb3d9da7bb61dcd593c440ae798fd75474ebed.zip
Python/ifconfig: cleanup import statements
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 987f0b13e..d9f28c8ef 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -17,9 +17,6 @@
import sys
import os
-import re
-import json
-import socket
import subprocess
import ipaddress
@@ -360,11 +357,15 @@ class Interface:
pidfile = dhclient_conf_dir + self._ifname + '.pid'
leasefile = dhclient_conf_dir + self._ifname + '.leases'
+ hostname = 'vyos'
+ with open('/etc/hostname', 'r') as f:
+ hostname = f.read().rstrip('\n')
+
a = [
'# generated by interface_config.py',
'option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;',
'interface \"' + self._ifname + '\" {',
- '\tsend host-name \"' + socket.gethostname() + '\";',
+ '\tsend host-name \"' + hostname + '\";',
'\trequest subnet-mask, broadcast-address, routers, domain-name-servers, rfc3442-classless-static-routes, domain-name, interface-mtu;',
'}'
]