From 13fb3d9da7bb61dcd593c440ae798fd75474ebed Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 30 Aug 2019 22:51:55 +0200 Subject: Python/ifconfig: cleanup import statements --- python/vyos/ifconfig.py | 9 +++++---- 1 file 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;', '}' ] -- cgit v1.2.3