[英]How to use setm in puppet
我想在 Puppet 中使用setm命令更改一個屬性名稱(“ modcluster.proxylist ”)。 我的以下代碼不起作用。 任何幫助深表感謝。
augeas { "jboss_domain_config":
incl => "/opt/domain.xml",
lens => "Xml.lns",
context => "/files/opt/domain.xml",
onlyif => "match /files/opt/domain.xml/domain/server-groups/*/system-properties/*/#attribute/name modcluster.proxylist"
changes => "setm /files/opt/domain.xml/domain/server-groups server-group[.]/system-properties/property[.]/#attribute/value kumaran",
}
以下是我想更改的源 XML。
<server-group name="ServiceGroupOne" profile="full-ha">
<system-properties>
<property name="jboss.default.multicast.address" value="232.0.2.20" boot-time="true"/>
<property name="modcluster.proxylist" value="192.168.79.77:7777" boot-time="true"/>
<property name="modcluster.lbgroup" value="SearchGroupOne" boot-time="true"/>
</system-properties>
</server-group>
<server-group name="ServiceGroupTwo" profile="full-ha">
<system-properties>
<property name="jboss.default.multicast.address" value="232.0.2.20" boot-time="true"/>
<property name="modcluster.lbgroup" value="SearchGroupTwo" boot-time="true"/>
<property name="modcluster.proxylist" value="192.168.79.77:7777" boot-time="true"/>
</system-properties>
</server-group>
<server-group name="ServiceGroupThree" profile="full-ha">
<system-properties>
<property name="modcluster.lbgroup" value="CommonSearchGroup" boot-time="true"/>
<property name="modcluster.proxylist" value="192.168.79.77:7777" boot-time="true"/>
<property name="jboss.default.multicast.address" value="232.0.2.20" boot-time="true"/>
</system-properties>
</server-group>
里面有不少問題。 讓我們一一處理它們:
您提供的domain.xml
代碼似乎是錯誤的,因為沒有您的 Puppet 代碼所建議的domain
和server-groups
節點。 我認為您提供的代碼還有兩個級別:
<domain> <server-groups> <!-- the rest of the file --> <server-groups> <domain>
使用incl
和lens
時無需設置context
,它是自動的
setm
工作方式:第一個參數是 Augeas 將在其上循環的節點集,第二個是要設置的子節點,第三個是值setm
做的改變setm
是冪等的,真的沒有必要在這里使用onlyif
。結果如下:
augeas { "jboss_domain_config":
incl => "/tmp/domain.xml",
lens => "Xml.lns",
changes => "setm domain/server-groups/server-group system-properties/property[#attribute/name='modcluster.proxylist']/#attribute/value kumaran",
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.