xmlxml-parsingaugeas

Can't figure out how to properly add onlyif in augeas


I have the following xml:

<subsystem xmlns="urn:jboss:domain:undertow:1.1">
    <buffer-cache name="default"/>
    <server name="default-server">
        <http-listener max-post-size="104857600" name="undertow-http" proxy-address-forwarding="${proxy.address.forwarding}" receive-buffer="524288" redirect-socket="https" send-buffer="524288" socket-binding="http"/>
        <https-listener max-post-size="104857600" name="undertow-https" proxy-address-forwarding="${proxy.address.forwarding}" receive-buffer="524288" security-realm="ewb-ssl" send-buffer="524288" socket-binding="https" verify-client="NOT_REQUESTED"/>
        <host alias="localhost" name="default-host"/>
    </server>
    <servlet-container name="default">
        <jsp-config/>
        <persistent-sessions/>
    </servlet-container>
    <handlers/>
</subsystem>

with augeas i'm changing some values in that xml:

 set subsystem[#attribute/xmlns='urn:jboss:domain:undertow:1.1']/server[#attribute/name='default-server']/http-listener[#attribute/name='undertow-http']/#attribute/proxy-address-forwarding 'true'",

but after the running application the following attribute in xml

xmlns='urn:jboss:domain:undertow:1.1

changes to:

xmlns='urn:jboss:domain:undertow:1.2

and after that augeas begins to add new fields in xml file:

<subsystem><server><http-listener proxy-address-forwarding="true"></http-listener>

I've tried to add onlyif conditions to avoid adding extra fields but without succes, can someone help? Thanks


Solution

  • Works with:

    onlyif  => "get #attribute/xmlns == 'urn:jboss:domain:undertow:1.1'",