From 57df93bb17da1653b1f090874f468ca8b4b3ce05 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Wed, 30 Jul 2025 14:40:01 -0500 Subject: T7672: fix field entries for paths shared across .xml files Use the correct pointer reference to append entries to the 'files' and 'children' fields when paths are shared across .xml files. --- python/vyos/xml_ref/generate_op_cache.py | 26 ++++++++++++++------------ python/vyos/xml_ref/op_definition.py | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'python') diff --git a/python/vyos/xml_ref/generate_op_cache.py b/python/vyos/xml_ref/generate_op_cache.py index 266c81cd0..84553df0e 100755 --- a/python/vyos/xml_ref/generate_op_cache.py +++ b/python/vyos/xml_ref/generate_op_cache.py @@ -202,21 +202,23 @@ def insert_node( if comp_scripts: comp_help['script'] = comp_scripts - cur_node_data = NodeData() - cur_node_data.name = name - cur_node_data.node_type = node_type - cur_node_data.comp_help = comp_help - cur_node_data.help_text = help_text - cur_node_data.command = command_text - cur_node_data.standalone_help_text = standalone_help_text - cur_node_data.standalone_command = standalone_command - cur_node_data.path = path - cur_node_data.file = file - - value = {('__node_data', None): cur_node_data} + new_node_data = NodeData() + new_node_data.name = name + new_node_data.node_type = node_type + new_node_data.comp_help = comp_help + new_node_data.help_text = help_text + new_node_data.command = command_text + new_node_data.standalone_help_text = standalone_help_text + new_node_data.standalone_command = standalone_command + new_node_data.path = path + + value = {('__node_data', None): new_node_data} key = (name, node_type) cur_value = d.setdefault(key, value) + # track the correct pointer reference: + cur_node_data = cur_value[('__node_data', None)] + cur_node_data.files.append(file) if parent and key not in parent.children: parent.children.append(key) diff --git a/python/vyos/xml_ref/op_definition.py b/python/vyos/xml_ref/op_definition.py index 7b0a45a5b..95492cd17 100644 --- a/python/vyos/xml_ref/op_definition.py +++ b/python/vyos/xml_ref/op_definition.py @@ -35,7 +35,7 @@ class NodeData: standalone_help_text: Optional[str] = None standalone_command: Optional[str] = None path: list[str] = field(default_factory=list) - file: str = '' + files: list[str] = field(default_factory=list) children: list[tuple] = field(default_factory=list) -- cgit v1.2.3