diff options
author | Christian Breunig <christian@breunig.cc> | 2023-12-11 18:23:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 18:23:04 +0100 |
commit | 787917a89375606380be97cade0d9ed648cdc49f (patch) | |
tree | 87f1daf9cf4d269739323a000a093f8c086415b0 /src/op_mode/nat.py | |
parent | fedb2ee0c677dca23de24d9e70ff239e7556da28 (diff) | |
parent | 3d3418d1585cbb6d3c2d1d81d310a3107e16c4aa (diff) | |
download | vyos-1x-787917a89375606380be97cade0d9ed648cdc49f.tar.gz vyos-1x-787917a89375606380be97cade0d9ed648cdc49f.zip |
Merge pull request #2612 from nicolas-fort/T5807-nat66-opmode
T5807: fix op-mode command <show nat66>
Diffstat (limited to 'src/op_mode/nat.py')
-rwxr-xr-x | src/op_mode/nat.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/op_mode/nat.py b/src/op_mode/nat.py index 71a40c0e1..2bc7e24fe 100755 --- a/src/op_mode/nat.py +++ b/src/op_mode/nat.py @@ -28,9 +28,6 @@ from vyos.configquery import ConfigTreeQuery from vyos.utils.process import cmd from vyos.utils.dict import dict_search -base = 'nat' -unconf_message = 'NAT is not configured' - ArgDirection = typing.Literal['source', 'destination'] ArgFamily = typing.Literal['inet', 'inet6'] @@ -293,8 +290,9 @@ def _verify(func): @wraps(func) def _wrapper(*args, **kwargs): config = ConfigTreeQuery() + base = 'nat66' if 'inet6' in sys.argv[1:] else 'nat' if not config.exists(base): - raise vyos.opmode.UnconfiguredSubsystem(unconf_message) + raise vyos.opmode.UnconfiguredSubsystem(f'{base.upper()} is not configured') return func(*args, **kwargs) return _wrapper |