diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-08-30 10:32:18 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-08-30 10:32:18 +0200 |
commit | c58c276923220c4da9a1c3ca2f3f445dc5bcd0a5 (patch) | |
tree | fd426ec1094f7ac9f928d2384a50f7895a50bcba /python/vyos/interfaceconfig.py | |
parent | 71f7a947539963112c61fef2a5f278d524d71198 (diff) | |
download | vyos-1x-c58c276923220c4da9a1c3ca2f3f445dc5bcd0a5.tar.gz vyos-1x-c58c276923220c4da9a1c3ca2f3f445dc5bcd0a5.zip |
Python/ifconfig: remove trailing whitespaces
Diffstat (limited to 'python/vyos/interfaceconfig.py')
-rw-r--r-- | python/vyos/interfaceconfig.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/python/vyos/interfaceconfig.py b/python/vyos/interfaceconfig.py index 56e2d515c..30188166a 100644 --- a/python/vyos/interfaceconfig.py +++ b/python/vyos/interfaceconfig.py @@ -30,7 +30,7 @@ class Interface: if not ifname: raise Exception("interface name required") if not os.path.exists('/sys/class/net/{0}'.format(ifname)) and not type: - raise Exception("interface {0} not found".format(str(ifname))) + raise Exception("interface {0} not found".format(str(ifname))) else: if not os.path.exists('/sys/class/net/{0}'.format(ifname)): try: @@ -100,7 +100,7 @@ class Interface: if not ifalias: self._ifalias = self._ifname else: - self._ifalias = str(ifalias) + self._ifalias = str(ifalias) open('/sys/class/net/{0}/ifalias'.format(self._ifname),'w').write(self._ifalias) @@ -130,12 +130,12 @@ class Interface: def _debug(self, e=None): - """ + """ export DEBUG=1 to see debug messages """ if os.getenv('DEBUG') == '1': if e: - print ("Exception raised:\ncommand: {0}\nerror code: {1}\nsubprocess output: {2}".format(e.cmd, e.returncode, e.output.decode()) ) + print ("Exception raised:\ncommand: {0}\nerror code: {1}\nsubprocess output: {2}".format(e.cmd, e.returncode, e.output.decode()) ) return True return False @@ -214,7 +214,7 @@ class Interface: def get_ipv4_addr(self): """ - reads all IPs assigned to an interface and returns it in a list, + reads all IPs assigned to an interface and returns it in a list, or None if no IP address is assigned to the interface """ ips = [] @@ -346,13 +346,13 @@ class Interface: pidfile = dhclient_conf_dir + self._ifname + '.pid' leasefile = dhclient_conf_dir + self._ifname + '.leases' - a = [ + 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() +'\";', '\trequest subnet-mask, broadcast-address, routers, domain-name-servers, rfc3442-classless-static-routes, domain-name, interface-mtu;', - '}' + '}' ] cnf = "" @@ -378,7 +378,7 @@ class Interface: pidfile = dhclient_conf_dir + self._ifname + '.pid' leasefile = dhclient_conf_dir + self._ifname + '.leases' if not os.path.exists(pidfile): - return 1 + return 1 try: ret = subprocess.check_output(['/sbin/dhclient -4 -r -pf ' + pidfile], shell=True).decode() return True @@ -453,5 +453,5 @@ class Interface: return True -#### TODO: dhcpv6-pd via dhclient +#### TODO: dhcpv6-pd via dhclient |