diff options
| author | Daniil Baturin <daniil@baturin.org> | 2025-07-30 20:01:59 +0100 |
|---|---|---|
| committer | Daniil Baturin <daniil@baturin.org> | 2025-07-30 20:01:59 +0100 |
| commit | 3d686f3922c204ce3d0793f62bc9eb4a10c23805 (patch) | |
| tree | 3ab2ef47e5f1d47785f79ea27c91b652583930fa /python | |
| parent | 1483b66eb957f48af9f86b54fc1780b41c4553e1 (diff) | |
| download | vyos-1x-3d686f3922c204ce3d0793f62bc9eb4a10c23805.tar.gz vyos-1x-3d686f3922c204ce3d0793f62bc9eb4a10c23805.zip | |
op-mode: T7669: fail op mode cache generation if there are untranslated variables
since that means the command is malformed
Diffstat (limited to 'python')
| -rwxr-xr-x | python/vyos/xml_ref/generate_op_cache.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/python/vyos/xml_ref/generate_op_cache.py b/python/vyos/xml_ref/generate_op_cache.py index e985e8d6b..7f0bbf115 100755 --- a/python/vyos/xml_ref/generate_op_cache.py +++ b/python/vyos/xml_ref/generate_op_cache.py @@ -88,6 +88,14 @@ def translate_position(s: str, pos: list[str]) -> str: def translate_command(s: str, pos: list[str]) -> str: s = translate_exec(s) s = translate_position(s, pos) + + # If there are any untranslated occurences of '_place_holder_", + # it means the command is incorrect, + # e.g., it references "$6" when it only has five words. + if re.search(r'_place_holder_', s): + print(f"Command translation failed: {s}") + sys.exit(1) + return s |
