summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-28 11:00:06 -0500
committerGitHub <noreply@github.com>2019-10-28 11:00:06 -0500
commit4efcd7d44b2194eb36b381fd0ad639fd402c6c6d (patch)
tree8b5fe1163cdba0e001056413da1a2c8fce48f112
parentaac75107bc9988ecb599265da029827ff09bf713 (diff)
parent8ae02a738df9746ad648a9611ae03e62b5af9e5d (diff)
downloadvyos-1x-4efcd7d44b2194eb36b381fd0ad639fd402c6c6d.tar.gz
vyos-1x-4efcd7d44b2194eb36b381fd0ad639fd402c6c6d.zip
Merge pull request #154 from zdc/T1772
[XML templates] T1772: Add escaping of `\` symbol in `<regex>`
-rw-r--r--interface-definitions/https.xml2
-rw-r--r--interface-definitions/interfaces-bonding.xml2
-rw-r--r--interface-definitions/snmp.xml4
-rwxr-xr-xscripts/build-command-templates2
4 files changed, 5 insertions, 5 deletions
diff --git a/interface-definitions/https.xml b/interface-definitions/https.xml
index 2fb3bf082..403d4ecb0 100644
--- a/interface-definitions/https.xml
+++ b/interface-definitions/https.xml
@@ -27,7 +27,7 @@
<constraint>
<validator name="ipv4-address"/>
<validator name="ipv6-address"/>
- <regex>^\\*$</regex>
+ <regex>^\*$</regex>
</constraint>
</properties>
<children>
diff --git a/interface-definitions/interfaces-bonding.xml b/interface-definitions/interfaces-bonding.xml
index c71482d9c..ba1acfff6 100644
--- a/interface-definitions/interfaces-bonding.xml
+++ b/interface-definitions/interfaces-bonding.xml
@@ -159,7 +159,7 @@
<description>combine IP address and port to make hash</description>
</valueHelp>
<constraint>
- <regex>(layer2\\+3|layer3\\+4|layer2)</regex>
+ <regex>(layer2\+3|layer3\+4|layer2)</regex>
</constraint>
<constraintErrorMessage>hash-policy must be layer2 layer2+3 or layer3+4</constraintErrorMessage>
</properties>
diff --git a/interface-definitions/snmp.xml b/interface-definitions/snmp.xml
index 14aad90a0..bdfbd4ab6 100644
--- a/interface-definitions/snmp.xml
+++ b/interface-definitions/snmp.xml
@@ -552,7 +552,7 @@
<properties>
<help>Specifies the oid</help>
<constraint>
- <regex>^[0-9]+(\\.[0-9]+)*$</regex>
+ <regex>^[0-9]+(\.[0-9]+)*$</regex>
</constraint>
<constraintErrorMessage>OID must start from a number</constraintErrorMessage>
</properties>
@@ -566,7 +566,7 @@
<properties>
<help>Defines a bit-mask that is indicating which subidentifiers of the associated subtree OID should be regarded as significant</help>
<constraint>
- <regex>^[0-9a-f]{2}([\\.:][0-9a-f]{2})*$</regex>
+ <regex>^[0-9a-f]{2}([\.:][0-9a-f]{2})*$</regex>
</constraint>
<constraintErrorMessage>MASK is a list of hex octets, separated by '.' or ':'</constraintErrorMessage>
</properties>
diff --git a/scripts/build-command-templates b/scripts/build-command-templates
index ba80eadb2..4fcdb8ade 100755
--- a/scripts/build-command-templates
+++ b/scripts/build-command-templates
@@ -125,7 +125,7 @@ def get_properties(p):
regexes = []
regex_elements = vce.findall("regex")
if regex_elements is not None:
- regexes = list(map(lambda e: e.text.strip(), regex_elements))
+ regexes = list(map(lambda e: e.text.strip().replace('\\','\\\\'), regex_elements))
if "" in regexes:
print("Warning: empty regex, node will be accepting any value")