[augeas-devel] shellvars lense

David Lutterkort lutter at redhat.com
Tue Jun 9 17:43:50 UTC 2009


On Tue, 2009-06-09 at 18:27 +0100, David Robinson wrote:
> Is there any particular reason that the shellvars lense only includes
> certain files in /etc/sysconfig?

Not all files in /etc/sysconfig are actually shellvars files
(e.g. /etc/sysconfig/iptables) - some of them are handled by other
lenses, and reading the same file with two different lenses will lead to
tears.

>  I want to use augeas (via puppet) to
> change options in /etc/sysconfig/myapp, but the lense doesn't want to
> know about the file. I modified the lense so that it includes
> everything in /etc/sysconfig, but I suspect there's a reason for the
> filter...

You can do that without changing shellvars.aug, and in two different
ways:

(1) Write a small custom module and drop it
into /usr/share/augeas/lenses. The module would look something like

        module Myapp =
          autoload xfm
        
          let xfm = transform Shellvars.lns (incl "/etc/sysconfig/myapp")
        
(2) Since Augeas 0.5.0, you can also control at runtime what files get
loaded:

        augtool --noload
        augtool> rm /augeas/load/*
        augtool> set /augeas/load/Myapp/lens Shellvars.lns
        augtool> set /augeas/load/Myapp/incl /etc/sysconfig/myapp
        augtool> load
        
Unfortunalely, doing it this way isn't exposed in the puppet type for
augeas (yet)

David





More information about the augeas-devel mailing list