diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-14 17:10:20 +0100 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-04-14 17:10:20 +0100 |
commit | 7d04bfbcc74e062b80b337753e7018a6af81e70c (patch) | |
tree | 4482e09b8cec0368a7de654ef8511d8c7adcad4b | |
parent | 7b0ab5a3c8edd5d925cc57e2e3f3dedea7f36adc (diff) | |
download | vyos-1x-7d04bfbcc74e062b80b337753e7018a6af81e70c.tar.gz vyos-1x-7d04bfbcc74e062b80b337753e7018a6af81e70c.zip |
op_mode: T2223: two cosmetic change and bug fix
-rw-r--r-- | python/vyos/ifconfig/operational.py | 2 | ||||
-rwxr-xr-x | src/op_mode/show_interfaces.py | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/operational.py b/python/vyos/ifconfig/operational.py index 5a292f90b..d585c1873 100644 --- a/python/vyos/ifconfig/operational.py +++ b/python/vyos/ifconfig/operational.py @@ -142,7 +142,7 @@ class Operational(Control): stats[k] = int(v) return stats except IOError: - return stats + return no_stats def clear_counters(self, counters=None): clear = self._stats_all if counters is None else [] diff --git a/src/op_mode/show_interfaces.py b/src/op_mode/show_interfaces.py index c5d4c8ac6..8b6690b7d 100755 --- a/src/op_mode/show_interfaces.py +++ b/src/op_mode/show_interfaces.py @@ -20,7 +20,6 @@ import re import sys import datetime import argparse -from subprocess import Popen, PIPE, STDOUT import netifaces from vyos.ifconfig import Section @@ -87,7 +86,7 @@ def split_text(text, used=0): text: the string to split used: number of characted already used in the screen """ - returned = Popen('stty size', stdout=PIPE, stderr=STDOUT, shell=True).communicate()[0].strip().split() + returned = cmd('stty size') if len(returned) == 2: rows, columns = [int(_) for _ in returned] else: @@ -240,7 +239,9 @@ def run_clear_intf(intf, iftypes, vif, vrrp): @register('reset') def run_reset_intf(intf, iftypes, vif, vrrp): - os.remove() + for interface in filtered_interfaces(ifnames, iftypes, vif, vrrp): + interface = Interface(ifname, create=False, debug=False) + interface.operational.reset_counters() if __name__ == '__main__': |