[augeas-devel] Variables must be set in order?

Raphaël Pinson raphink at gmail.com
Mon May 11 10:36:28 UTC 2009


On Mon, May 11, 2009 at 6:45 AM, Matt Palmer <matt at anchor.net.au> wrote:

> I think this kinda says it all, really:
>
> ---8<---
>
> grog:~# augtool
> augtool> set /files/etc/network/interfaces/iface[4] br0
> augtool> set /files/etc/network/interfaces/iface[4]/method manual
> augtool> set /files/etc/network/interfaces/iface[4]/family inet
> augtool> set /files/etc/network/interfaces/iface[4]/address 192.168.12.14
> augtool> set /files/etc/network/interfaces/iface[4]/netmask 255.255.255.0
> augtool> save
> Saving failed
> augtool>  ls /augeas/files/etc/network/interfaces/error/
> path = /files/etc/network/interfaces/iface
> lens = /usr/share/augeas/lenses/dist/interfaces.aug:77.16-81.46
> message = Failed to match
> /(family/)(method/)((((allow-[a-z-][a-z-][a-z-]*_[_a-z-]*|allow-[a-z-]_[_a-z-]*|allow-(_[_a-z-]*|)|allow([_a-z][_a-z-]*|)|allo([_a-vx-z-][_a-z-]*|)|all([_a-np-z-][_a-z-]*|)|auto[_a-z-][_a-z-]*|aut([_a-np-z-][_a-z-]*|)|au([_a-su-z-][_a-z-]*|)|al([_a-km-z-][_a-z-]*|)|iface[_a-z-][_a-z-]*|ifac([_a-df-z-][_a-z-]*|)|ifa([_abd-z-][_a-z-]*|)|if([_b-z-][_a-z-]*|)|mapping[_a-z-][_a-z-]*|mappin([_a-fh-z-][_a-z-]*|)|mappi([_a-mo-z-][_a-z-]*|)|mapp([_a-hj-z-][_a-z-]*|)|map([_a-oq-z-][_a-z-]*|)|ma([_a-oq-z-][_a-z-]*|)|(m[_b-z-]|i[_a-eg-z-]|a[_a-km-tv-z-]|[_b-hj-ln-z-][_a-z-])[_a-z-]*|m|i|a|[_b-hj-ln-z-])/)|(#comment/)|(/))*)/
> with method/family/address/netmask/
> augtool> exit
> grog:~# augtool
> augtool> set /files/etc/network/interfaces/iface[4] br0
> augtool> set /files/etc/network/interfaces/iface[4]/family inet
> augtool> set /files/etc/network/interfaces/iface[4]/method manual
> augtool> set /files/etc/network/interfaces/iface[4]/address 192.168.12.14
> augtool> set /files/etc/network/interfaces/iface[4]/netmask 255.255.255.0
> augtool> save
> Saved 1 file(s)
>
> --->8---
>
> For the love of all that is holy, WHY?
>


Because Augeas doesn't understand what the config file means, variable order
is important. The format is like this :

"iface eth0 inet manual"

which is mapped as
{ "iface" = "eth0"
       { "family" = "inet" }
       { "method = "manual" } }

Now imagine that this format also allows (I know it doesn't, but it could) :

"iface eth0 method=manual family=inet"

which would get mapped as

{ "iface" = "eth0"
    { "method" = "manual" }
    { "family"    = "inet" } }


While the interpretation of the config file might lead to the same results
in the application using it, Augeas has no idea about that, and inverting
the variables in the tree changes the config file drammatically. Again, this
is not a real life example, but you can easily imagine how real life
examples would work (see sudoers if you want to pull your hair with this
kind of "priority matters" config parameters).



Raphaël




>
>
> --
> Matt Palmer - Systems Administrator
>
> A view into the Anchor Engineroom: http://anchor.com.au/blog/
> Web Hosting Knowledgebase: http://anchor.com.au/wiki/
>
> Anchor Systems Pty Ltd - Hosting Heavyweights
> W: http://www.anchor.com.u - E: support at anchor.com.au
> Phone: 1300 883 979 - Fax: 02 8296 5199
>
>
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20090511/d7c9252e/attachment.htm>


More information about the augeas-devel mailing list