diff options
| author | John Estabrook <jestabro@vyos.io> | 2026-01-29 20:50:07 -0600 |
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2026-02-06 14:42:47 -0600 |
| commit | b4f79c7428c26815da0c4bb192f29b5b2b5a34b4 (patch) | |
| tree | b48ca03db856c8a1d1645931e626178635d82d82 /src | |
| parent | 9186d3f1cfff21af08d64f94612967bfa5775c9c (diff) | |
| download | vyos1x-config-b4f79c7428c26815da0c4bb192f29b5b2b5a34b4.tar.gz vyos1x-config-b4f79c7428c26815da0c4bb192f29b5b2b5a34b4.zip | |
T8232: Config_tree.get_subtree should preserve tag attribute at root
This is useful when walking a subtree of a config tree, as is used in
config_dict.
Diffstat (limited to 'src')
| -rw-r--r-- | src/config_tree.ml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/config_tree.ml b/src/config_tree.ml index 2f7d814..6a25c31 100644 --- a/src/config_tree.ml +++ b/src/config_tree.ml @@ -247,9 +247,21 @@ let get_subtree ?(with_node=false) node path = try let n = (Vytree.get[@alert "-exn"]) node path in if with_node then - Vytree.make_full default_data "" [n] + let data = + (* preserve tag attribute *) + match (is_tag_value node path) with + | true -> {default_data with tag = true} + | false -> default_data + in + Vytree.make_full data "" [n] else - Vytree.make_full default_data "" (Vytree.children_of_node n) + let data = + (* preserve tag attribute *) + match (is_tag node path) with + | true -> {default_data with tag = true} + | false -> default_data + in + Vytree.make_full data "" (Vytree.children_of_node n) with Vytree.Nonexistent_path -> make "" let value_paths_of_tree node = |
