Skip to content

Commit

Permalink
Merge pull request #2614 from vyos/mergify/bp/sagitta/pr-2612
Browse files Browse the repository at this point in the history
T5807: fix op-mode command <show nat66> (backport #2612)
  • Loading branch information
sever-sever authored Dec 11, 2023
2 parents 5b2ee47 + 841ab78 commit 5230bf8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/op_mode/nat.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
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']

Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 5230bf8

Please sign in to comment.