summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-07-02 16:28:58 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2023-07-02 16:41:13 +0000
commit3596d3e5d6d20ebb46a4b9365108280325839ef0 (patch)
treecd35800771793f7570aa6b912946b1af2242fcfc /src/op_mode
parent1a6640a7443410b667818a3545c306ea451cd137 (diff)
downloadvyos-1x-3596d3e5d6d20ebb46a4b9365108280325839ef0.tar.gz
vyos-1x-3596d3e5d6d20ebb46a4b9365108280325839ef0.zip
T5332: Fix show policy route without attahed interface
Interface may not be present in the op-mode dictionary, it cause KeyError: 'interface' for policy route
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/policy_route.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/op_mode/policy_route.py b/src/op_mode/policy_route.py
index 5953786f3..fae47adec 100755
--- a/src/op_mode/policy_route.py
+++ b/src/op_mode/policy_route.py
@@ -61,8 +61,10 @@ def output_policy_route(name, route_conf, ipv6=False, single_rule_id=None):
ip_str = 'IPv6' if ipv6 else 'IPv4'
print(f'\n---------------------------------\n{ip_str} Policy Route "{name}"\n')
- if route_conf['interface']:
+ if route_conf.get('interface'):
print('Active on: {0}\n'.format(" ".join(route_conf['interface'])))
+ else:
+ print('Inactive - Not applied to any interfaces\n')
details = get_nftables_details(name, ipv6)
rows = []