diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-07-30 14:40:01 -0500 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2025-07-30 15:37:44 -0500 |
| commit | 57df93bb17da1653b1f090874f468ca8b4b3ce05 (patch) | |
| tree | 7e59a536c63a2493aaed9c390f822dd7b38b0a12 | |
| parent | a551fa45573ef57858904773d4bcc99dbf553b19 (diff) | |
| download | vyos-1x-57df93bb17da1653b1f090874f468ca8b4b3ce05.tar.gz vyos-1x-57df93bb17da1653b1f090874f468ca8b4b3ce05.zip | |
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.
| -rwxr-xr-x | python/vyos/xml_ref/generate_op_cache.py | 26 | ||||
| -rw-r--r-- | python/vyos/xml_ref/op_definition.py | 2 |
2 files changed, 15 insertions, 13 deletions
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) |
