On Tue, 2008-12-16 at 09:52 +0100, Thomas Bellman wrote:
> 1. Is it possible to specify what lens to use for editing a
>     certain file?  Can I for instance tell it to use the sshd lens
>     to edit an sshd config file in a non-standard place?

Add the directory with your custom lens to the load_path; augeas will
then load that lens instead of the default one.

>   Or to
>     use the shellvars lens to edit /etc/sysconfig/sendmail (the
>     version of Augeas in Fedora 9 happily edits lots of other
>     files in /etc/sysconfig, but not the sendmail file).  Do I
>     have to write a new lens for this?

That was an oversight; I just comitted a fix to add that file in
shellvars.aug.

For now, you can work around that by adding a module like
        module Sendmail
          autoload xfm
        
          let xfm = transform Shellvars.lns (incl "/etc/sysconfig/sendmail")

> 2. How do I modify an entry in the tree, as opposed to rewrite it
>     with a fixed string?  For example, the grub.conf file has
>     lines saying
> 
>       kernel /vmlinuz-2.6.27.5-41.fc9.x86_64 ro root=/dev/sda2 rhgb quiet
> 
>     and I want to remove the words "rhgb" and "quiet".  Just doing
> 
>       set /files/etc/grub.conf/title[1]/kernel
>           "/vmlinuz-2.6.27.5-41.fc9.x86_64 ro root=/dev/sda2"
> 
>     is the wrong answer, because I might not know what "/dev/sda2"
>     should be on every system, and I certainly do not know what
>     the version of the kernel should be.
> 
>     You might think that I could use the $kernelrelease fact, but
>     the kernel line I want to modify might not be for the kernel
>     that is actually running.

Yeah, that is a problem. It's not quite a solution, but to allow such
operations we'd need to change the grub lens to split the kernel line
into individual arguments, so that you get something like

        /files/etc/grub.conf/title[1]/kernel = "/vmlinuz-2.6.27.5-41.fc9.x86_64"
        /files/etc/grub.conf/title[1]/kernel/arg = "ro"
        /files/etc/grub.conf/title[1]/kernel/arg = "root=/dev/sda2"
        /files/etc/grub.conf/title[1]/kernel/arg = "rhgb"
        /files/etc/grub.conf/title[1]/kernel/arg = "quiet"
        
Right now, you're still stuck even with that - I am working on extending
the query language so that you could remove the "rhgb" arg with
something like

        rm /files/etc/grub.conf/title/kernel[value() = 
"/vmlinuz-2.6.27.5-41.fc9.x86_64"]/arg[value() = "rhgb"]
       
and do the same for all kernels with 

        rm /files/etc/grub.conf/title/kernel/arg[value() = "rhgb"]             
        
but unfortunately, that isn't quite finished yet.

> 4. In the /etc/logrotate.conf file in Fedora and CentOS, there is
>     an entry on the form:
> 
>       /var/log/wtmp {
>           monthly
>           create 0664 root utmp
>           rotate 1
>       }
> 
>     I want to comment out, or remove entirely, that entry.  I can
>     find it with
> 
>       match /files/etc/logrotate.conf/*/file "/var/log/wtmp"
> 
>     which right now happens to give me
> 
>       /files/etc/logrotate.conf/rule[1]/file
> 
>     After finding that information, I want to do
> 
>       rm /files/etc/logrotate.conf/rule[1]
> 
>     but how do I feed the information from the match back to the
>     rm command?

That will also require the XPath extension I am working on, so that you
can say

        rm /files/etc/logrotate.conf/rule[file = "/var/log/wtmp"]
        
David


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to