On Mon, 2010-02-22 at 01:16 -0800, Tim Stoop wrote:
> Hi all,
> 
> I'm trying to work with augeas to add pinnings to my /etc/apt/
> preferences file. But I'm not getting my head around it. If I do the
> simplest I can think of:
> 
>       augeas { "Apt/preferences pinnings for augeas-lenses.":
>               context => "/files/etc/apt/preferences",
>               changes => ["set 00/Explanation 'We need these from 
> backports.'",
>                           "set 00/Package augeas-lenses",
>                           "set 00/Pin release",
>                           "set 00/Pin/a lenny-backports",
>                           "set 00/Pin-Priority 999"],
>       }
> 
> it adds the definition to the bottom of the file each time. If I
> change the context into
> 
>       context => "match /files/etc/apt/preferences/*/Package augeas-
> lenses",

You want to restrict when to make those changes with the onlyif
paramater, something like

        augeas { "...":
          context => ...
          changes => ...
          onlyif => "match *[ Pin = 'release' and Package = 'augeas-lenses'] 
size == 0"
        }

> it only works if there's already an augeas-lenses definition
> available. In which "working" is a large word, because if the current
> Pin-Priority is 900, it doesn't set it to 999.

You'd need to add another augeas resource to cover that case, something
like

        augeas { "...":
          context => "/files/etc/apt/preferences[Pin = 'release' and Package = 
'augeas-lenses']",
          changes => "set Pin-Priority 900", 
          onlyif => "match * size == 0"
        }

>  If there's no augeas-
> lenses definition available, it *segfaults*:
> 
> /usr/lib/ruby/1.8/augeas.rb:48: [BUG] Segmentation fault
> ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
> 
> Aborted

When that happens, is libaugeas0 installed ?

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-us...@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