summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2026-09-22 13:09:25 -0500
committerJohn Estabrook <jestabro@vyos.io>2026-09-23 11:49:32 -0500
commit0476f58f8ddf16708e3fdaa476abd96e836a0381 (patch)
tree4d3734919d449c0064ad1372600cbb0e70f9dfeb /python
parentbbcd30800da93e6fad110b712cde4654db467c11 (diff)
downloadvyos-1x-0476f58f8ddf16708e3fdaa476abd96e836a0381.tar.gz
vyos-1x-0476f58f8ddf16708e3fdaa476abd96e836a0381.zip
T9341: add argument to remove paths when generating caches
Diffstat (limited to 'python')
-rwxr-xr-xpython/vyos/xml_ref/generate_cache.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/python/vyos/xml_ref/generate_cache.py b/python/vyos/xml_ref/generate_cache.py
index daea50dc9..44514f708 100755
--- a/python/vyos/xml_ref/generate_cache.py
+++ b/python/vyos/xml_ref/generate_cache.py
@@ -60,6 +60,9 @@ def main():
parser.add_argument('--package-name', type=non_trivial, default='vyos-1x',
help='name of current package')
parser.add_argument('--output-path', help='path to generated cache')
+ parser.add_argument(
+ '--exclude-paths', action='extend', nargs='+', help='exclude paths from cache'
+ )
args = vars(parser.parse_args())
xml_dir = abspath(args['xml_dir'])
@@ -69,10 +72,21 @@ def main():
path = out_path if out_path is not None else pkg_cache
xml_cache = abspath(join(path, cache_name))
internal_cache = args['internal_cache']
+ exclude_paths = args['exclude_paths'] or []
+ # we accept paths as directory path strings, with possible 'node.tag'
+ # entries, for comparison with removal in template dirs in the Makefile
+ exclude_paths = list(
+ map(lambda l: [c for c in l.split('/') if c and c != 'node.tag'], exclude_paths)
+ )
+ json_exclude_paths = json.dumps(exclude_paths)
try:
- reference_tree_to_json(xml_dir, xml_tmp,
- internal_cache=internal_cache)
+ reference_tree_to_json(
+ xml_dir,
+ xml_tmp,
+ internal_cache=internal_cache,
+ exclude_paths=json_exclude_paths,
+ )
except ConfigTreeError as e:
print(e)
sys.exit(1)