I'm trying to add or update a user in an xml config file using augeas resource type in Puppet, here the manifest:
augeas { "nexus_user_newadmin":
lens => "Xml.lns",
incl => "security.xml",
root => "/usr/local/nexus/conf",
changes => [
"defnode user /files/security.xml/security/users/user[id/#text='newadmin']",
"set $user/id/#text 'newadmin'",
"set $user/firstName/#text 'first name'",
"set $user/lastName/#text 'last name'",
"set $user/password/#text 'passhere'",
"set $user/status/#text 'active'",
"set $user/email/#text 'test@domain.com'",
],
}
The xml file looks like :
<?xml version="1.0"?>
<security>
<users>
...
<user>
<id>deployment</id>
<firstName>Deployment</firstName>
<lastName>User</lastName>
<password>somepasshere</password>
<status>active</status>
<email>changeme1@yourcompany.com</email>
</user>
</users>
</security>
I get the error following when I run the manifest:
Main/Augeas[nexus_user_newadmin]: Could not evaluate: missing string argument 3 for defnode
It looks like the command defnode needs 3 mandatory arguments when used from puppet, but only 2 (and 1 optional) when used from augtool. (see my original post)
How can I overcome this limitations in augeas implementation in Puppet ?