I'm trying to use puppet to edit the jenkins config.xml. I have decided augeas makes the most sense for various reasons, and I nearly have what I need, but the formatting is pretty rough.
This is my puppet file:
augeas { 'jenkins_config.xml' :
incl => '/tmp/config.xml',
lens => 'Xml.lns',
context => '/files/tmp/config.xml/hudson',
changes => [
"set securityRealm/#attribute/class hudson.security.PAMSecurityRealm",
"set securityRealm/#attribute/plugin pam-auth@1.0",
"set securityRealm/serviceName/#text sshd",
],
}
What I'm looking for:
<hudson>
<securityRealm class="hudson.security.PAMSecurityRealm" plugin="pam-auth@1.0">
<serviceName>sshd</serviceName>
</securityRealm>
</hudson>
What I'm getting:
<hudson>
<securityRealm class="hudson.security.PAMSecurityRealm" plugin="pam-auth@1.0"><serviceName>sshd</serviceName>
</securityRealm>
</hudson>
The contents are fine (which is so awesome, by the way) but it's no fun to read. Can augeas handle the indentation and newlines for me? If I have to do it myself, can anyone provide tips on indentation? My attempts all failed.