diff options
author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2023-12-11 20:19:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 20:19:35 +0200 |
commit | 5230bf864d159eb6b3a57f45089a83e44df7ec1a (patch) | |
tree | 66517b8cd3ae6bd19fe413ece4b024018421d074 /src | |
parent | 5b2ee47e85b536800897e4f4a475ca3167238254 (diff) | |
parent | 841ab78776539861cd61aa04d81ca759ca2ac11d (diff) | |
download | vyos-1x-5230bf864d159eb6b3a57f45089a83e44df7ec1a.tar.gz vyos-1x-5230bf864d159eb6b3a57f45089a83e44df7ec1a.zip |
Merge pull request #2614 from vyos/mergify/bp/sagitta/pr-2612
T5807: fix op-mode command <show nat66> (backport #2612)
Diffstat (limited to 'src')
-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 |