mardi 4 août 2015

Puppet Augeas - cannot update value in xml node containing CDATA

I have an xml document similar to this:

<?xml version="1.0" encoding="UTF-8"?>
<example>
    <member name="dbsettings">
        <node name="username"><![CDATA[someusername]]></node>
        <node name="password"><![CDATA[mypassword]]></node>
    </member>
    <member name="sitesettings">
        <node name="title"><![CDATA[just a title]]></node>
    </member>
</example>

And I'm trying to update these settings in puppet using the following augeas command:

set example/member[#attributes/name='dbsettings']/node[#attributes/name='username']/#text anotherusername

What I expect it to do is to replace the entire contents of the node by "anotherusername" instead it just appends it resulting in:

<node name="username"><![CDATA[someusername]]>anotherusername</node>

How can I select and update the contents of the CDATA element using augeas or remove it without removing the actual node itself? (the real node contains more attributes which I don't want to hard-code in)

Aucun commentaire:

Enregistrer un commentaire