diff options
author | Daniil Baturin <daniil@baturin.org> | 2016-12-30 23:23:16 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2016-12-30 23:23:16 +0700 |
commit | 766a2cb172eb2bce67f05350c9712e7a7f3adb9c (patch) | |
tree | 6dd541cdc1813ff598eed75dc4daf62221be1820 | |
parent | 4f69b2c58a53e405eb23d5763de774e9526420a0 (diff) | |
download | vyconf-766a2cb172eb2bce67f05350c9712e7a7f3adb9c.tar.gz vyconf-766a2cb172eb2bce67f05350c9712e7a7f3adb9c.zip |
Remove the extends attribute from <interfaceDefinition>
It's problematic for multiple reasons:
1. It's plaintext and is hard to verify
2. If it's wrong, it may have a very "interesting" effect on the
resulting reference tree, such as lots of misplaced nodes
3. It's hardly ever needed as most nodes only go one or two levels deep
in VyOS, such as "service $something" or "interfaces $something",
and I think it's unlikely that other appliances will differ much.
-rw-r--r-- | data/schemata/interface_definition.rnc | 9 | ||||
-rw-r--r-- | data/schemata/interface_definition.rng | 10 | ||||
-rw-r--r-- | src/reference_tree.ml | 5 |
3 files changed, 2 insertions, 22 deletions
diff --git a/data/schemata/interface_definition.rnc b/data/schemata/interface_definition.rnc index 913123c..fc063ac 100644 --- a/data/schemata/interface_definition.rnc +++ b/data/schemata/interface_definition.rnc @@ -24,14 +24,7 @@ # Interface definition starts with interfaceDefinition tag that may contain node tags start = element interfaceDefinition { - extendsAttr?, node* -} - -# Interface definitions may extend other definitions -# In this case you specify a whitespace-separated path -extendsAttr = attribute extends -{ - text + node* } # node tag may contain node, leafNode, or tagNode tags diff --git a/data/schemata/interface_definition.rng b/data/schemata/interface_definition.rng index a1330ee..596b4d9 100644 --- a/data/schemata/interface_definition.rng +++ b/data/schemata/interface_definition.rng @@ -28,22 +28,12 @@ <!-- Interface definition starts with interfaceDefinition tag that may contain node tags --> <start> <element name="interfaceDefinition"> - <optional> - <ref name="extendsAttr"/> - </optional> <zeroOrMore> <ref name="node"/> </zeroOrMore> </element> </start> <!-- - Interface definitions may extend other definitions - In this case you specify a whitespace-separated path - --> - <define name="extendsAttr"> - <attribute name="extends"/> - </define> - <!-- node tag may contain node, leafNode, or tagNode tags Those are intermediate configuration nodes that may only contain other nodes and must not have values diff --git a/src/reference_tree.ml b/src/reference_tree.ml index 29b4265..b717d19 100644 --- a/src/reference_tree.ml +++ b/src/reference_tree.ml @@ -115,10 +115,7 @@ let load_from_xml reftree file = let xml_to_reftree xml reftree = match xml with | Xml.Element ("interfaceDefinition", attrs, children) -> - let basepath = - try Pcre.split (Xml.attrib xml "extends") - with _ -> [] - in List.fold_left (insert_from_xml basepath) reftree children + List.fold_left (insert_from_xml []) reftree children | _ -> raise (Bad_interface_definition "Should start with <interfaceDefinition>") in try |