summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-09-06 15:21:34 -0500
committerGitHub <noreply@github.com>2022-09-06 15:21:34 -0500
commitacd3a42355da185e06670c1a23550589fce0e2f9 (patch)
tree10e140d3c78d11deb0271cac0361c72f093eb322
parent31138f43f4a5714077adbbd22ff774b2d4ce37f8 (diff)
parentfa568074ec6c58f345b8c7dbcc565d132b2b3291 (diff)
downloadvyos-1x-acd3a42355da185e06670c1a23550589fce0e2f9.tar.gz
vyos-1x-acd3a42355da185e06670c1a23550589fce0e2f9.zip
Merge pull request #1524 from jestabro/bridge-op-mode
bridge: T4673: raise UnconfiguredSubsystem on non-existent bridge intf
-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