diff options
-rw-r--r-- | .gitattributes | 5 | ||||
-rw-r--r-- | .vscode/settings.json | 2 | ||||
-rwxr-xr-x | src/op_mode/nat.py | 6 |
3 files changed, 3 insertions, 10 deletions
diff --git a/.gitattributes b/.gitattributes index 624e00f03..1d79e0804 100644 --- a/.gitattributes +++ b/.gitattributes @@ -73,8 +73,3 @@ .gitkeep export-ignore *.pyc binary export-ignore *.pyo binary export-ignore - -# -# Enable syntax highlighting for VSCode settings -# -.vscode/settings.json linguist-language=jsonc diff --git a/.vscode/settings.json b/.vscode/settings.json index ab3af6cf1..27ed4c296 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,7 @@ "*.xml.in": "xml", }, "[jinja]": { - "editor.wordBasedSuggestions": false + "editor.wordBasedSuggestions": "off" }, // https://code.visualstudio.com/docs/python/settings-reference "python.analysis.extraPaths": [ 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 |