summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/control.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-03-31 16:59:33 +0100
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-03-31 16:59:55 +0100
commit05e79a4bb2137ee3ea563ced7f64b033c41eb438 (patch)
tree4569cd88efc01a1473e90dfd90b271ac54e9f711 /python/vyos/ifconfig/control.py
parent458ccfc2f0fe46d399d2412af60d8ade26b57f65 (diff)
downloadvyos-1x-05e79a4bb2137ee3ea563ced7f64b033c41eb438.tar.gz
vyos-1x-05e79a4bb2137ee3ea563ced7f64b033c41eb438.zip
ifconfig: T2057: allow to disable interface debugging
In order to be able to use the interface class with operational mode, these commands must not log as it would otherwise mess with the output on the screen.
Diffstat (limited to 'python/vyos/ifconfig/control.py')
-rw-r--r--python/vyos/ifconfig/control.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/python/vyos/ifconfig/control.py b/python/vyos/ifconfig/control.py
index 1c9f7e284..c1a073aef 100644
--- a/python/vyos/ifconfig/control.py
+++ b/python/vyos/ifconfig/control.py
@@ -24,8 +24,18 @@ class Control(Register):
_command_get = {}
_command_set = {}
+ def __init__(self, **kargs):
+ # some commands (such as operation comands - show interfaces, etc.)
+ # need to query the interface statistics. If the interface
+ # code is used and the debugging is enabled, the screen output
+ # will include both the command but also the debugging for that command
+ # to prevent this, debugging can be explicitely disabled
+
+ # if debug is not explicitely disabled the the config, enable it
+ self.debug = kargs.get('debug', True)
+
def _debug_msg(self, msg):
- if os.path.isfile('/tmp/vyos.ifconfig.debug'):
+ if os.path.isfile('/tmp/vyos.ifconfig.debug') and self.debug:
print('DEBUG/{:<6} {}'.format(self.config['ifname'], msg))
def _popen(self, command):