Thanks Aaron,
I reread that and this time found the snippet I needed ...
The following works ...
onlyif    => "match FW_CONFIGURATIONS_EXT/value[.='$svc'] size == 0",

Cheers

On 7 June 2011 08:51, Aaron Grewell <[email protected]> wrote:

> I found this Wiki article tremendously valuable when dealing with Augeas.
> http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas
>
> On Mon, Jun 6, 2011 at 3:45 PM, Michael Knox <[email protected]>wrote:
>
>> Hi,
>> I'm working on a type to undertake some very simple management of the SuSE
>> firewall service (/etc/sysconfig/SuSEfirewall2), specifcally I need to
>> manage the contents of the list FW_CONFIGURATIONS_EXT which is handled as a
>> shell list.
>>
>> I've been able to use the shellvars_list.aug to manage the file, but I'm
>> struggling with the puppet filter / onlyif.
>>
>> The following works in augtool:
>> match FW_CONFIGURATIONS_EXT/value $svc
>> I then wanted to check that the size of this array was 0 before adding the
>> service.
>>
>> However this fails with ...
>> err:
>> /Stage[main]/Svn::Server/Firewall::Service[svn]/Augeas[fwservice_svn]: Could
>> not evaluate: Error sending command 'match' with params nil/Unknown command
>> svn
>>
>> So this filter argument for match is supported in Augeas, but not in the
>> Augeas provider.
>>
>> Is there a better way of doing this with the current provider?
>>
>> The manifest code in question ....
>>     augeas {"fwservice_$svc":
>>       context   => "/files/etc/sysconfig/SuSEfirewall2",
>>       onlyif    => "match FW_CONFIGURATIONS_EXT/value $svc size == 0",
>>       #onlyif    => "match FW_CONFIGURATIONS_EXT/value not_include $svc",
>>       changes   => [
>>                    "set FW_CONFIGURATIONS_EXT/value[last()+1] $svc",
>>       ],
>>       load_path => "$augeas::params::lense_path",
>>       require   => Augeas::Lense['shellvars_list.aug'],
>>     }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Puppet Users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/puppet-users?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>

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

Reply via email to