voxpupuli / puppet-augeasproviders

Alternative Augeas-based providers for Puppet
http://augeasproviders.com/
Apache License 2.0
63 stars 46 forks source link

XML types #150

Open raphink opened 6 years ago

raphink commented 6 years ago

One of the main uses of Augeas in Puppet is to edit XML nodes. The typical use identifies a node and sets its text and/or attributes, so I'd suggest an xml_node type like so:

xml_node { 'some node':
  ensure       => present,             # or absent, maybe positioned as well
  target       => '/path/to/file.xml',
  path         => '/path/to/node',     # allow to pass an Augeas expression to filter out node
  text         => 'my text value',     # maybe a way to remove the value
  attributes   => {
    attr1 => 'val1',
    attr2 => 'val2',
  },
  attr_append  => true,                # should we not replace the attributes?
}

Would that be useful? Is it missing something?