[PATCH] Remove extraneous single quotes from IPV6ADDR_SECONDARIES
by jiahu
The IPV6ADDR_SECONDARIES setting in ifcfg files was being set
with an extra set of single quotes.
For example:
After defining a interface with multi-ipv6 addresses
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0
DEVICE=enp2s0
ONBOOT=yes
IPV6INIT=yes
IPV6_AUTOCONF=no
DHCPV6C=no
IPV6ADDR=2002::200/64
IPV6ADDR_SECONDARIES="'2002::201/64 2002::202/64'"
Should like below:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp2s0
DEVICE=enp2s0
ONBOOT=yes
IPV6INIT=yes
IPV6_AUTOCONF=no
DHCPV6C=no
IPV6ADDR=2002::200/64
IPV6ADDR_SECONDARIES="2002::201/64 2002::202/64"
Since the extra quotes are added in all cases, this patch just
unconditionally removes them.
---
data/xml/redhat-get.xsl | 2 --
data/xml/suse-get.xsl | 2 --
tests/redhat/schema/ipv6-static-multi.xml | 2 +-
tests/suse/schema/ipv6-static-multi.xml | 2 +-
4 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/data/xml/redhat-get.xsl b/data/xml/redhat-get.xsl
index 923dde0..a3970de 100644
--- a/data/xml/redhat-get.xsl
+++ b/data/xml/redhat-get.xsl
@@ -226,14 +226,12 @@
<xsl:if test="count(ip) > 1">
<node label="IPV6ADDR_SECONDARIES">
<xsl:attribute name="value">
- <xsl:text>'</xsl:text>
<xsl:for-each select="ip[1]/following-sibling::ip[following-sibling::ip]">
<xsl:value-of select="@address"/><xsl:if test="@prefix">/<xsl:value-of select="@prefix"/></xsl:if><xsl:value-of select="string(' ')"/>
</xsl:for-each>
<xsl:for-each select="ip[last()]">
<xsl:value-of select="@address"/><xsl:if test="@prefix">/<xsl:value-of select="@prefix"/></xsl:if>
</xsl:for-each>
- <xsl:text>'</xsl:text>
</xsl:attribute>
</node>
</xsl:if>
diff --git a/data/xml/suse-get.xsl b/data/xml/suse-get.xsl
index 182d292..bc5eb72 100644
--- a/data/xml/suse-get.xsl
+++ b/data/xml/suse-get.xsl
@@ -243,14 +243,12 @@
<xsl:if test="count(ip) > 1">
<node label="IPV6ADDR_SECONDARIES">
<xsl:attribute name="value">
- <xsl:text>'</xsl:text>
<xsl:for-each select="ip[1]/following-sibling::ip[following-sibling::ip]">
<xsl:value-of select="@address"/><xsl:if test="@prefix">/<xsl:value-of select="@prefix"/></xsl:if><xsl:value-of select="string(' ')"/>
</xsl:for-each>
<xsl:for-each select="ip[last()]">
<xsl:value-of select="@address"/><xsl:if test="@prefix">/<xsl:value-of select="@prefix"/></xsl:if>
</xsl:for-each>
- <xsl:text>'</xsl:text>
</xsl:attribute>
</node>
</xsl:if>
diff --git a/tests/redhat/schema/ipv6-static-multi.xml b/tests/redhat/schema/ipv6-static-multi.xml
index d865a05..f1f82cd 100644
--- a/tests/redhat/schema/ipv6-static-multi.xml
+++ b/tests/redhat/schema/ipv6-static-multi.xml
@@ -7,6 +7,6 @@
<node label="IPV6_AUTOCONF" value="no"/>
<node label="DHCPV6C" value="no"/>
<node label="IPV6ADDR" value="3ffe:ffff:0:5::1/128"/>
- <node label="IPV6ADDR_SECONDARIES" value="'3ffe:ffff:0:5::3/128 3ffe:ffff:0:5::5/128'"/>
+ <node label="IPV6ADDR_SECONDARIES" value="3ffe:ffff:0:5::3/128 3ffe:ffff:0:5::5/128"/>
</tree>
</forest>
diff --git a/tests/suse/schema/ipv6-static-multi.xml b/tests/suse/schema/ipv6-static-multi.xml
index d865a05..f1f82cd 100644
--- a/tests/suse/schema/ipv6-static-multi.xml
+++ b/tests/suse/schema/ipv6-static-multi.xml
@@ -7,6 +7,6 @@
<node label="IPV6_AUTOCONF" value="no"/>
<node label="DHCPV6C" value="no"/>
<node label="IPV6ADDR" value="3ffe:ffff:0:5::1/128"/>
- <node label="IPV6ADDR_SECONDARIES" value="'3ffe:ffff:0:5::3/128 3ffe:ffff:0:5::5/128'"/>
+ <node label="IPV6ADDR_SECONDARIES" value="3ffe:ffff:0:5::3/128 3ffe:ffff:0:5::5/128"/>
</tree>
</forest>
--
1.8.1.4
9 years, 1 month
[PATCH] eliminate netcf-specific sysconfig.aug lense
by Laine Stump
Back in 2010 when netcf needed a separate augeas lense for files in
sysconfig/network-scripts (e.g. the ifcfg-* files), augeas itself had
no special purpose sysconfig.aug lense, so netcf has its own
sysconfig.aug lens based on the shellvars.aug lense from augeas at the
time. Sometime soon after that augeas got its own sysconfig.aug lense,
but netcf never rid itself of its own copy.
The sysconfig.aug in netcf is now severely out of date compared to the
one in augeas, and is missing many bugfixes. This patch just removes
the netcf version from /usr/share/netcf/lenses, so that augeas will
use its own lense when it's called by netcf. Among other things, this
updated lense properly ignores semicolons and "#"-initiated partial
line comments at the ends of lines that contain valid variable
settings at the beginning.
This resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=761246
---
Makefile.am | 1 -
data/lenses/sysconfig.aug | 60 -----------------------------------------------
2 files changed, 61 deletions(-)
delete mode 100644 data/lenses/sysconfig.aug
diff --git a/Makefile.am b/Makefile.am
index d35fd18..d380ec8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,6 @@ dist_xml_DATA=data/xml/augeas.rng data/xml/interface.rng \
dist_netcf_DATA=data/iptables-forward-bridged
dist_lens_DATA= \
data/lenses/netcf.aug \
- data/lenses/sysconfig.aug \
data/lenses/persist_net_rules.aug \
data/lenses/routes.aug
diff --git a/data/lenses/sysconfig.aug b/data/lenses/sysconfig.aug
deleted file mode 100644
index 9ee668e..0000000
--- a/data/lenses/sysconfig.aug
+++ /dev/null
@@ -1,60 +0,0 @@
-(* Variation of the Shellvars lens *)
-(* Supports only what's needed to handle sysconfig files *)
-(* Modified to strip quotes. In the put direction, add double quotes *)
-(* around values that need them *)
-(* To keep things simple, we also do not support shell variable arrays *)
-module Sysconfig =
- let eol = Util.eol
-
- let key_re = /[A-Za-z0-9_]+(\[[0-9]+\])?/ - "unset" - "export"
- let eq = Util.del_str "="
- let comment = Util.comment
- let empty = Util.empty
- let xchgs = Build.xchgs
- let dels = Util.del_str
-
- let nothing = del /(""|'')?/ "" . value ""
-
- (* Chars allowed in a bare string *)
- let bchar = /[^ \t\n\"'\\]|\\\\./
- let qchar = /["']/ (* " *)
-
- (* We split the handling of right hand sides into a few cases:
- * bare - strings that contain no spaces, optionally enclosed in
- * single or double quotes
- * dquot - strings that contain at least one space or apostrophe,
- * which must be enclosed in double quotes
- * squot - strings that contain an unescaped double quote
- *)
- let bare = del qchar? "" . store (bchar+) . del qchar? ""
- let dquot =
- del qchar "\"" . store (bchar* . /[ \t']/ . bchar*)+ . del qchar "\""
- let squot =
- dels "'" . store ((bchar|/[ \t]/)* . "\"" . (bchar|/[ \t]/)*)+ . dels "'"
-
- let export = [ key "export" . Util.del_ws_spc ]
- let kv (value:lens) = [ export? . key key_re . eq . value . eol ]
- let assign = kv nothing | kv bare | kv dquot | kv squot
-
- let var_action (name:string) =
- [ xchgs name ("@" . name) . Util.del_ws_spc . store key_re . eol ]
-
- let unset = var_action "unset"
- let bare_export = var_action "export"
-
- let source =
- [
- del /\.|source/ "." . label ".source" .
- Util.del_ws_spc . store /[^= \t\n]+/ . eol
- ]
-
- let lns = (comment | empty | source | assign | unset | bare_export) *
-
-(*
- Examples:
-
- abc -> abc -> abc
- "abc" -> abc -> abc
- "a b" -> a b -> "a b"
- 'a"b' -> a"b -> 'a"b'
-*)
--
2.1.0
9 years, 1 month