Resource Type: xmlfile_modification
- Defined in:
- lib/puppet/type/xmlfile_modification.rb
Overview
Apply a change or an array of changes constrained by conditionals, to a specified xml file using syntax similar to the augeas XML lens. Changes are applied in memory during content generation when the catalog is applied.
Requires:
-
REXML
Sample usage with strings:
xmlfile_modification{"test" :
file => "/etc/activemq/activemq.conf.xml",
changes => "set /beans/broker/transportConnectors/transportConnector[last()+1]/#attribute/name \"test\"",
onlyif => "match /beans/broker/transportConnectors/transportConnector[#attribute/name == \"test\"] size < 1",
}
Sample usage with arrays:
xmlfile_modification{"test" :
file => "/etc/activemq/activemq.conf.xml",
changes => [ "set /beans/broker/transportConnectors/transportConnector[last()+1]/#attribute/name \"tests\"",
"set /beans/broker/transportConnectors/transportConnector[last()+1]/#attribute/value \"tests\""],
onlyif => [ "match /beans/broker/transportConnectors/transportConnector[#attribute/name == \"tests\"] size < 1" ],
}