diff options
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/ifconfig.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 7ae1d71bb..58fed7f62 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -41,7 +41,7 @@ interface "{{ intf }}" { dhclient_base = r'/var/lib/dhcp/dhclient_' class Interface: - def __init__(self, ifname=None, type=None, debug=False): + def __init__(self, ifname=None, type=None): """ Create instance of an IP interface @@ -57,9 +57,11 @@ class Interface: if not os.path.exists('/sys/class/net/{}'.format(ifname)) and not type: raise Exception('interface "{}" not found'.format(str(ifname))) - # variable already referenced from _debug() - self._debug = debug self._ifname = str(ifname) + self._debug = False + + if os.getenv('DEBUG') == '1': + self._debug = True if not os.path.exists('/sys/class/net/{}'.format(ifname)): cmd = 'ip link add dev "{}" type "{}"'.format(ifname, type) @@ -81,12 +83,6 @@ class Interface: print('"DEBUG/{}: {}'.format(self._ifname, msg)) - def set_debug(self, debug): - if debug not in [True, False]: - raise ValueError('must specify True or False for debug') - self._debug = debug - - def remove(self): """ Remove system interface |