I feel like I''m trying to do something simple. I''d like augeas
to add an
entry to an array, if and only if, it does not already exist. But, I
don''t see how to do this with the pragma specified by onlyif.
I''m not finding much for docs, but from what I can clean from
http://reductivelabs.com/trac/puppet/wiki/TypeReference#onlyif it looks
like I really want to use something like "match <path> !include
<string>"
Which is, of course, not supported.
It looks like the only support options require me to have pre-existing
knowledge about the entire array structure, which isn''t awful, but if I
knew that I''d just use a template.
So, any suggestions? For the curious, my actual use is this:
augeas{"network post-up route for net10" :
context => "/files/etc/network/interfaces/iface[2]",
changes => ''set post-up[last()+1] "route add -net
10.41.0.0/16 gw 192.168.0.1"'',
#onlyif => "match post-up include 10.41.0.0",
}
seph
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---
Ah ha. This would be http://projects.reductivelabs.com/issues/2047 seph seph <seph@directionless.org> writes:> I feel like I''m trying to do something simple. I''d like augeas to add an > entry to an array, if and only if, it does not already exist. But, I > don''t see how to do this with the pragma specified by onlyif. > > I''m not finding much for docs, but from what I can clean from > http://reductivelabs.com/trac/puppet/wiki/TypeReference#onlyif it looks > like I really want to use something like "match <path> !include <string>" > Which is, of course, not supported. > > It looks like the only support options require me to have pre-existing > knowledge about the entire array structure, which isn''t awful, but if I > knew that I''d just use a template. > > So, any suggestions? For the curious, my actual use is this: > > augeas{"network post-up route for net10" : > context => "/files/etc/network/interfaces/iface[2]", > changes => ''set post-up[last()+1] "route add -net 10.41.0.0/16 gw 192.168.0.1"'', > #onlyif => "match post-up include 10.41.0.0", > } > > seph > >--~--~---------~--~----~------------~-------~--~----~ 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On Thu, 2009-11-05 at 10:45 -0500, seph wrote:> So, any suggestions? For the curious, my actual use is this: > > augeas{"network post-up route for net10" : > context => "/files/etc/network/interfaces/iface[2]", > changes => ''set post-up[last()+1] "route add -net 10.41.0.0/16 gw 192.168.0.1"'', > #onlyif => "match post-up include 10.41.0.0", > }One way out will be matching on regular expressions, which is in augeas git, but not in a release yet. With that, you''ll be able to write onlyif => "match post-up[. =~ regexp(''.*10.41.0.0.*'')] size = 0" 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---