summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-03 18:59:50 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-03 19:00:24 +0200
commit35dcd0a1cb5d9a63dbebcb299eb9425b57258537 (patch)
tree9240a7cad13430e49cb3880e5b5318b9b4841b35 /python/vyos/ifconfig.py
parent01938cec2c2e19c8f556c2e5b425fc79d038126f (diff)
downloadvyos-1x-35dcd0a1cb5d9a63dbebcb299eb9425b57258537.tar.gz
vyos-1x-35dcd0a1cb5d9a63dbebcb299eb9425b57258537.zip
Python/ifconfig: T1557: cleanup __init__/debug
Diffstat (limited to 'python/vyos/ifconfig.py')
-rw-r--r--python/vyos/ifconfig.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 8cf5e1645..1d03e4e74 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -57,18 +57,16 @@ class Interface:
>>> from vyos.ifconfig import Interface
>>> i = Interface('eth0')
"""
+ self._ifname = str(ifname)
if not os.path.exists('/sys/class/net/{}'.format(ifname)) and not type:
- raise Exception('interface "{}" not found'.format(str(ifname)))
-
- self._ifname = str(ifname)
- self._debug = False
+ raise Exception('interface "{}" not found'.format(self._ifname))
if os.path.isfile('/tmp/vyos.ifconfig.debug'):
self._debug = True
- if not os.path.exists('/sys/class/net/{}'.format(ifname)):
- cmd = 'ip link add dev "{}" type "{}"'.format(ifname, type)
+ if not os.path.exists('/sys/class/net/{}'.format(self._ifname)):
+ cmd = 'ip link add dev "{}" type "{}"'.format(self._ifname, type)
self._cmd(cmd)
# per interface DHCP config files
@@ -83,7 +81,7 @@ class Interface:
def _debug_msg(self, msg):
- if self._debug:
+ if os.path.isfile('/tmp/vyos.ifconfig.debug'):
print('DEBUG/{:<6} {}'.format(self._ifname, msg))