On Wed, 2009-03-04 at 11:07 +1100, Avi Miller wrote: 
> I assume this means that the Augeas type doesn't support an array in 
> onlyif, but I thought I'd check to be 100% sure. :)

Yeah, that's what that means. Here's a dirty trick to check multiple
conditions:

        onlyif => "match /files[ (cond1 or cond2) and cond3] size == 0"
        
IOW, you can combine multiple path expressions with 'and' and 'or',
though you will have to use full paths in the conditions, since the
Augeas type won't understand that it has to set the context on the
inside, too.

So, to trigger the onlyif if you have an entry in /etc/hosts with IP
address 127.0.0.1 or a mail alias for root and sshd permits root login
(seriously contrived example), you can write

        match "/files[(count(/files/etc/hosts/*[ipaddr='127.0.0.1']) > 0 or 
count(/files/etc/aliases/*[name = 'root']) > 0) and 
count(/files/etc/ssh/sshd_config/PermitRootLogin[. = 'yes']) > 0]"
        
in augtool. The Augeas type might choke on all the spaces in the path
expression, not sure.

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