Bug #2696

augeas type - allow an 'if' statement in the minilanguage for changes

Added by David Lutterkort over 2 years ago. Updated about 1 year ago.

Status:Accepted Start date:10/04/2009
Priority:Normal Due date:
Assignee:Bryan Kearney % Done:

0%

Category:augeas
Target version:-
Affected Puppet version:0.25.0 Branch:
Keywords:
Votes: 0

Description

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:

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'"
}

History

Updated by Markus Roberts about 2 years ago

  • Target version set to 0.25.3

Updated by Markus Roberts about 2 years ago

  • Target version changed from 0.25.3 to 0.25.4

Updated by James Turnbull about 2 years ago

  • Target version changed from 0.25.4 to 0.25.5

Updated by James Turnbull almost 2 years ago

  • Target version changed from 0.25.5 to 49

Updated by James Turnbull over 1 year ago

  • Assignee changed from David Lutterkort to Bryan Kearney

Updated by James Turnbull about 1 year ago

  • Target version deleted (49)

Also available in: Atom PDF