From 96cf89f5fdd415fec930f77e2f70446f999187e4 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Thu, 7 Aug 2025 18:35:06 -0500 Subject: T7699: correctly update command/help fields for paths shared over files --- python/vyos/xml_ref/generate_op_cache.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 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 fb48debad..83900c7c7 100755 --- a/python/vyos/xml_ref/generate_op_cache.py +++ b/python/vyos/xml_ref/generate_op_cache.py @@ -223,23 +223,42 @@ def insert_node( new_node_data.standalone_help_text = standalone_help_text new_node_data.standalone_command = standalone_command new_node_data.path = path + new_node_data.files = [file] 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) if CHECK_XML_CONSISTENCY: out = node_data_difference(get_node_data(cur_value), get_node_data(value)) if out: err_buf.write(out) + # track the correct pointer reference: + cur_node_data = cur_value[('__node_data', None)] + + if file not in cur_node_data.files: + cur_node_data.files.append(file) + + if not cur_node_data.comp_help and comp_help: + cur_node_data.comp_help = comp_help + + if not cur_node_data.help_text and help_text: + cur_node_data.help_text = help_text + + if not cur_node_data.command and command_text: + cur_node_data.command = command_text + + if not cur_node_data.standalone_help_text and standalone_help_text: + cur_node_data.standalone_help_text = standalone_help_text + + if not cur_node_data.standalone_command and standalone_command: + cur_node_data.standalone_command = standalone_command + + if parent and key not in parent.children: + parent.children.append(key) + if children is not None: inner_nodes = children.iterfind('*') for inner_n in inner_nodes: -- cgit v1.2.3