1

我是 puppet 和 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>

4

0 回答 0