[augeas-devel] strange results using rm with the dhcpd lense
Robert Drake
rdrake at direcpath.com
Sun Mar 16 07:35:51 UTC 2014
I'm having a problem with the dhcpd lense rewriting subnets when I
delete one. From what I can tell through experimenting, it seems that
augeas is not so much deleting the previous subnet but instead it's
taking the values of the next subnet and writing it into this one.
Here is the example content:
# this comment is before the first subnet
subnet 192.168.1.0 netmask 255.255.255.0
{
option routers 192.168.1.1;
pool { range 192.168.1.2 192.168.1.254; }
}
# comment goes here
subnet 192.168.2.0 netmask 255.255.255.0
{
ddns-updates true;
next-server 192.168.15.2;
filename "pxelinux.0";
ddns-domainname "staging.direcpath.net";
option routers 192.168.2.1;
pool
{
range 192.168.2.2 192.168.2.254;
}
}
If I run "rm /files/test.conf/subnet[1]"
I get this as the output:
# this comment is before the first subnet
# comment goes here
subnet 192.168.2.0 netmask 255.255.255.0
{
ddns-updates true;
next-server 192.168.15.2;
filename "pxelinux.0";
ddns-domainname staging.direcpath.net;
option routers 192.168.2.1;
pool { range 192.168.2.2 192.168.2.254; }
}
You can see the first subnet's definition seems to have been rewritten,
with the 4 extra lines inserted where appropriate. This would be fine
except it's removing the formatting information when it does it and thus
removing the double quotes from ddns-domainname which causes validation
errors.
I can fix it by rewriting the lens to require double quotes for
ddns-domainname (which is how they seem to have fixed it for the
filename statement) but I'm wondering if the lens' statement syntax is
messed up in general. From what I understand, it's supposed to keep the
quotes on existing data and put them back when things change right?
More information about the augeas-devel
mailing list