I would like to update a section in an XML config file or add a new one if does not exist already using Augeas.
The XML file looks like this:
<?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 would like to update the last name/first name/email if the ID exists already or add a new user section if it's a new ID.
In AugTool I use:
augtool> set /augeas/load/Xml/lens Xml.lns
augtool> set /augeas/load/Xml/incl /security.xml
augtool> load
I'm still learning Augeas, so this was my first try to get the node :
augtool> print /files/security.xml/security/users/user/*[ #text= 'deployment']
What would be the command to update or create a new section user in users ?
thank you!