summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig.py
diff options
context:
space:
mode:
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))