Augeas match & Puppet

2,085 views
Skip to first unread message

Michael Knox

unread,
Jun 6, 2011, 6:45:11 PM6/6/11
to puppet...@googlegroups.com
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'],
    }

Aaron Grewell

unread,
Jun 6, 2011, 6:51:29 PM6/6/11
to puppet...@googlegroups.com
I found this Wiki article tremendously valuable when dealing with Augeas.
http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas

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

Michael Knox

unread,
Jun 6, 2011, 9:45:12 PM6/6/11
to puppet...@googlegroups.com
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

Rob McBroom

unread,
Jun 29, 2011, 11:02:19 AM6/29/11
to puppet...@googlegroups.com
On Jun 6, 2011, at 9:45 PM, Michael Knox wrote:

> The following works ...
> onlyif => "match FW_CONFIGURATIONS_EXT/value[.='$svc'] size == 0",


Couldn’t you just do this and not have to deal with “onlyif” at all?

set FW_CONFIGURATIONS_EXT/value[.='$svc'] $svc

Read the section of the wiki titled “A Better Way”. I have 26 Augeas resources and only one of them has “onlyif”.

--
Rob McBroom
<http://www.skurfer.com/>

Reply all
Reply to author
Forward
0 new messages