[augeas-devel] Augeas config help

David Lutterkort lutter at redhat.com
Wed Jan 6 19:36:05 UTC 2010


On Wed, 2010-01-06 at 13:40 -0500, Adam Stokes wrote:
> > 
> > You'll therefore need to make sure that comment does not match
> > commented-out settings by changing it to something (untested) like
> > 
> >         let comment     = 
> >           let settings = /MOUNTD_PORT|LOCKD_TCPPORT|.../ in
> >           let line_re = /([^ \t\n][^\n]*)?/ - (settings . /[ \t]*=[
> > \t]*.*/) in
> >           [ label "#comment" . del /#[ \t]*/ "# " .  store line_re .
> > del /\n/ "\n" ]
> > 
> > The important bit is the line_re which will match anything on a
> > comment
> 
> I've altered the lenses, however, when running through augtool all i see is :

Strange - are you sure it is picking up the right version of the lens ?
I just added the following tests to your module, and they pass:

        test lns get "MOUNTD_PORT=892\n" = { "MOUNTD_PORT" = "892" }
        
        test lns get "# MOUNTD_PORT=892\n" =
          { "MOUNTD_PORT" = "892"
              { "commented" } }
        
        test lns put "MOUNTD_PORT=892\n" after clear "/MOUNTD_PORT/commented" =
          "# MOUNTD_PORT=892\n"
        
        test lns put "# MOUNTD_PORT=892\n" after rm "/MOUNTD_PORT/commented" =
          "MOUNTD_PORT=892\n"

Also, playing around with augtool seems to confirm that the lens does
what it's supposed to do. Be careful: you also need to change
shellvars.aug and make sure it doesn't match /etc/sysconfig/nfs - that
actually might be your problem.

> The settings within the comment are not matched and the node after the
> commented settings does not seem to be showing up.

Does 'print /augeas//error' in augtool produce any output ?

> I attempted to change int_entry regex to something like
> 
>    let marker = [ del /#.*/ "# " . label "commented" ] in
> 
> however, it is still causing an error of duplicate matched entries.

Yes, that will cause both comment and int_entry to match a commented
setting. BTW, I recently added [1] to the Wiki to explain better what
all those typecheck errors mean.

[1]
http://augeas.net/page/Ambiguities_or_what_do_those_error_messages_from_the_typechecker_mean





More information about the augeas-devel mailing list