[augeas-devel] Parsing network-scripts/ifcfg-*

David Lutterkort dlutter at redhat.com
Mon Apr 21 23:09:57 UTC 2008


On Tue, 2008-04-22 at 00:45 +0200, Alan Pevec wrote:
> These are basically simple key = value lists, I cooked something from
> existing lentiles, feedback appreciated.

Cool ... this will make my pre-Starbucks script something like

        augtool <<EOF
        set /files/etc/sysconfig/network-scripts/ifcfg-eth0/ONBOOT no
        set /files/etc/sysconfig/network-scripts/ifcfg-br0/ONBOOT no
        EOF
        chkconfig NetworkManager on

and the reverse to turn bridged networking back on ;)

I committed this, with one small change:

> diff -r 73811a93b35f lenses/ifcfg.aug
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/lenses/ifcfg.aug  Tue Apr 22 00:40:45 2008 +0200
> @@ -0,0 +1,24 @@

> +
> +  let lns = (comment) * . (kv) *
> +

Changed that to

        let lns = (comment | kv)*
        
and updated test_ifcfg.aug accordingly, so that comments and key/value
lines can be freely mixed. The way comments are handled in yum.aug
(where I think the "comment* . kv*" came from) is a little more
complicated to make sure that a comment in between kv's does not end a
section in the yum config files.

thanks for the patch,
David





More information about the augeas-devel mailing list