diff options
author | John Estabrook <jestabro@vyos.io> | 2023-05-02 14:17:01 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-05-10 22:52:25 -0500 |
commit | 7b40f631380164ac0e06bfec3c82ceb667f98423 (patch) | |
tree | 36c46d1df5787bcf84c053caaaef630ad78b6e90 | |
parent | abc03517fe7784de951d930ba76f1bd7db5fe63b (diff) | |
download | vyos1x-config-7b40f631380164ac0e06bfec3c82ceb667f98423.tar.gz vyos1x-config-7b40f631380164ac0e06bfec3c82ceb667f98423.zip |
T5194: add default_value
-rw-r--r-- | src/reference_tree.ml | 10 | ||||
-rw-r--r-- | src/reference_tree.mli | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/reference_tree.ml b/src/reference_tree.ml index c9ce5a3..bf7f35a 100644 --- a/src/reference_tree.ml +++ b/src/reference_tree.ml @@ -26,6 +26,7 @@ type ref_node_data = { valueless: bool; owner: string option; priority: string option; + default_value: string option; keep_order: bool; hidden: bool; secret: bool; @@ -48,6 +49,7 @@ let default_data = { valueless = false; owner = None; priority = None; + default_value = None; keep_order = false; hidden = false; secret = false; @@ -166,7 +168,13 @@ let rec insert_from_xml basepath reftree xml = let node_owner = try let o = Xml.attrib xml "owner" in Some o with _ -> None in - let data = {data with node_type=node_type; owner=node_owner} in + let default_value_elem = find_xml_child "defaultValue" xml in + let default_value = + (match default_value_elem with + | Some (Xml.Element (_, _, [Xml.PCData s])) -> Some s + | _ -> None) + in + let data = {data with node_type=node_type; owner=node_owner; default_value=default_value} in let name = Xml.attrib xml "name" in let path = basepath @ [name] in let new_tree = Vytree.insert_maybe reftree path data in diff --git a/src/reference_tree.mli b/src/reference_tree.mli index 6d02093..fcd0c32 100644 --- a/src/reference_tree.mli +++ b/src/reference_tree.mli @@ -26,6 +26,7 @@ type ref_node_data = { valueless: bool; owner: string option; priority: string option; + default_value: string option; keep_order: bool; hidden: bool; secret: bool; |