summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-09-06 14:31:36 -0500
committerJohn Estabrook <jestabro@vyos.io>2022-09-06 14:31:36 -0500
commitfa568074ec6c58f345b8c7dbcc565d132b2b3291 (patch)
tree10e140d3c78d11deb0271cac0361c72f093eb322 /src/op_mode
parent31138f43f4a5714077adbbd22ff774b2d4ce37f8 (diff)
downloadvyos-1x-fa568074ec6c58f345b8c7dbcc565d132b2b3291.tar.gz
vyos-1x-fa568074ec6c58f345b8c7dbcc565d132b2b3291.zip
bridge: T4673: raise UnconfiguredSubsystem on non-existent bridge intf
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/bridge.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/op_mode/bridge.py b/src/op_mode/bridge.py
index fe8dadd70..5a821a287 100755
--- a/src/op_mode/bridge.py
+++ b/src/op_mode/bridge.py
@@ -22,7 +22,7 @@ import typing
from sys import exit
from tabulate import tabulate
-from vyos.util import cmd
+from vyos.util import cmd, rc_cmd
from vyos.util import dict_search
import vyos.opmode
@@ -57,7 +57,11 @@ def _get_raw_data_fdb(bridge):
"""Get MAC-address for the bridge brX
:returns list
"""
- json_data = cmd(f'sudo bridge --json fdb show br {bridge}')
+ code, json_data = rc_cmd(f'sudo bridge --json fdb show br {bridge}')
+ # From iproute2 fdb.c, fdb_show() will only exit(-1) in case of
+ # non-existent bridge device; raise error.
+ if code == 255:
+ raise vyos.opmode.UnconfiguredSubsystem(f"no such bridge device {bridge}")
data_dict = json.loads(json_data)
return data_dict