Jackie McIntyre
2014-Oct-30 18:17 UTC
[Puppet Users] Using Augeas in puppet to modify JBoss Config
Hello Everyone,
I'm new to both puppet and Augeas and I'm having trouble.
I have a puppet module that installs JBoss EAP 6.3 (in standalone mode),
but I need to upgrade the scripts to allow users to configure their JBoss
deployment with SSL. This leads me to try and use puppet to insert some
XML into the standalone.xml configuration file. One of the xml elements
must have multiple attributes in it. I used the augtool on the command
line and was able to insert the element with one attribute. But when I try
to set more attributes in the existing element I am not able to figure out
how to format the path or commands. Any assistance you can provide would
be greatly appreciated!
Example augtool commands:
augtool> set /augeas/load/Xml/lens Xml.lns
augtool> set /augeas/load/Xml/incl[2]
/usr/share/jboss/jboss-eap-6.3/standalone/configuration/standalone.xml
augtool> load
augtool> set
/files/usr/share/jboss/jboss-eap-6.3/standalone/configuration/standalone.xml/server/profile/subsystem[#attribute/xmlns="urn:jboss:domain:web:2.1"]/connector[last()+1]/#attribute[name="https"]/name
"https"
augtool> save
Saved 1 file(s)
Attempt 1:
augtool> set /augeas/load/Xml/lens Xml.lns
augtool> set /augeas/load/Xml/incl[2]
/usr/share/jboss/jboss-eap-6.3/standalone/configuration/standalone.xml
augtool> load
augtool> set
/files/usr/share/jboss/jboss-eap-6.3/standalone/configuration/standalone.xml/server/profile/subsystem[#attribute/xmlns="urn:jboss:domain:web:2.1"]/connector[last()+1]/#attribute[name="https"]/name
"https"
augtool> set
/files/usr/share/jboss/jboss-eap-6.3/standalone/configuration/standalone.xml/server/profile/subsystem[#attribute/xmlns="urn:jboss:domain:web:2.1"]/connector[last()]/#attribute[protocol="HTTP/1.1"]/protocol
"HTTP/1.1"
augtool> save
error: Failed to execute command
saving failed (run 'print /augeas//error' for details)
augtool> print /augeas//error
/augeas/files/usr/share/jboss/jboss-eap-6.3/standalone/configuration/standalone.xml/error/message
= "Failed to match \n { /#attribute/ }?({ /#text/ =
/(\\\\]\\\\]\\\\]*[^]\\001-\\004<>][^]\\001-\\004<]*\\\\]|(\\\\][^]\\001-\\004<]|[^]\\001-\\004<][^]\\001-\\004<])[^]\\001-\\004<]*\\\\]|[^]\\001-\\004<]\\\\])(\\\\]\\\\]*[^]\\001-\\004<>][^]\\001-\\004<]*\\\\]|[^]\\001-\\004<][^]\\001-\\004<]*\\\\])*(\\\\]\\\\]*([^]\\001-\\004<>][^]\\001-\\004<]*|)|[^]\\001-\\004<][^]\\001-\\004<]*|)|\\\\]\\\\]\\\\]*([^]\\001-\\004<>][^]\\001-\\004<]*|)|(\\\\][^]\\001-\\004<]|[^]\\001-\\004<][^]\\001-\\004<])[^]\\001-\\004<]*|\\\\]|[^]\\001-\\004<]/
} | { /#comment/ = /([^\\001-\\004-]|-[^\\001-\\004-])*/ } | <<rec>>
| {
/[:A-Z_a-z][.0-:A-Z_a-z-]*/ = /#empty/ } | { /#pi/ })*\n with tree\n {
\"#attribute\" } { \"#attribute\" }"
Ultimately what I'd like to do is figure out a set of commands that will
help me create and insert the following XML that looks like:
<connector name="https" protocol="HTTP/1.1"
scheme="https"
socket-binding="https">
<ssl name="https" password="mypassword"
certificate-key-file="${jboss.server.config.dir}/keystore.jks"/>
</connector>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/e571209b-f235-4dc7-9127-50771d5685e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.