Augeas和XML为puppet设置多个属性

时间:2014-10-30 18:43:58

标签: xml puppet augeas

我是傀儡和Augeas的新手,我遇到了麻烦。 我有一个安装JBoss EAP 6.3的puppet模块(在独立模式下),但我需要升级脚本以允许用户使用SSL配置他们的JBoss部署。这导致我尝试使用puppet将一些XML插入standalone.xml配置文件中。其中一个xml元素必须包含多个属性。我在命令行上使用了augtool,并且能够插入具有一个属性的元素。但是当我尝试在现有元素中设置更多属性时,我无法弄清楚如何格式化路径或命令。非常感谢您提供的任何帮助!

示例augtool命令:

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)

尝试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\" }"

最终,我想要做的是找出一组命令,帮助我创建和插入以下XML:

<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>

0 个答案:

没有答案