Is it possible to change few portions of the value in Augeas

asked 2015-11-19 04:24:13 -0500

I would like to change the few portion in the value part of xml. Is it possible to do it in Augeas ?

For eg:

I would like to change the IP_ADDRESS alone in the following xml. It has been placed in three places. Is it possible to do it ?

<interfaces>
    <interface name="management">
        <inet-address value="${jboss.bind.address.management:IP_ADDRESS}"/>
    </interface>
    <interface name="public">
        <inet-address value="${jboss.bind.address:IP_ADDRESS}"/>
    </interface>
    <interface name="unsecure">
        <inet-address value="${jboss.bind.address.unsecure:IP_ADDRESS}"/>
    </interface>
</interfaces>

To achieve it, I have the following approach which is not helping me either.

augeas { "jboss_host_config":
    incl    => "${hc_home}/domain/configuration/host.xml",
    lens    => "Xml.lns",
    changes => ['set /files/${hc_home}/domain/configuration/host.xml/host/domain-controller/remote/#attribute/host ${remotehost}',
    'set /files/${hc_home}/domain/configuration/host.xml/host/management/security-realms/security-realm/server-identities/secret/#attribute/value $secretvalue',
    'rm /files/${hc_home}/domain/configuration/host.xml/host/interfaces',
    'ins interfaces after /files/${hc_home}/domain/configuration/host.xml/host/domain-controller',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/#text[1] "\n        "',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/interface[1]/#attribute/name management',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/#text[2] "        "',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/interface[2]/#attribute/name public',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/#text[3] "        "',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/interface[3]/#attribute/name unsecure',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/interface[1]/inet-address/#attribute/value ${managehost}',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/interface[2]/inet-address/#attribute/value ${publichost}',
    'set /files/${hc_home}/domain/configuration/host.xml/host/interfaces/interface[3]/inet-address/#attribute/values ${unsecurehost}'],
    require => File["${hc_home}/domain/configuration/host.xml"]
}
edit retag flag offensive close merge delete