Issue #2696 has been updated by James Turnbull.

Target version changed from 0.25.5 to 0.25.6


----------------------------------------
Bug #2696: augeas type - allow an 'if' statement in the minilanguage for changes
http://projects.puppetlabs.com/issues/2696

Author: David  Lutterkort
Status: Accepted
Priority: Normal
Assigned to: David  Lutterkort
Category: augeas
Target version: 0.25.6
Affected version: 0.25.0
Keywords: 
Branch: 


Currently, it is only possible to turn an augeas resource on or off in its 
entirety by using the 'onlyif' parameter. Often, it is desirable to make 
different kinds of changes depending on what the augeas tree looks like 
precisely. For example, if in some file the setting 'foo' is not set to '1', 
check whether the setting exists already; if so, jjust change its value to '1'. 
If not, create the setting and a comment about it; as a rough draft, this would 
could be written in the following manner:

<pre>
augeas { fiddle-foo:
  context => "..."
  changes => "
  if match foo size == 0 then
    set foo '1'
    ins #comment before foo
    set #comment[following-sibling::*[1][label() = 'foo']] 'modified by puppet'
  else
    set foo '1'
  end
  "
  onlyif => "get foo != '1'"
}
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" 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-bugs?hl=en.

Reply via email to