简体   繁体   English

如何在Augeas木偶中使用条件运算

[英]How to use conditional operation in augeas puppet

I can insert/edit any attributes or any text in XML file. 我可以在XML文件中插入/编辑任何属性或任何文本。

Is it possible to insert/edit any attributes or any text in XML File. 是否可以在XML文件中插入/编辑任何属性或任何文本。

For eg: I would like to change the value of a property, If it is named as " modcluster.proxylist ". 例如:我想更改一个属性的值,如果它被命名为“ modcluster.proxylist ”。

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

The augeas puppet type has an onlyif attribute which lets you decide whether it will be ran or not. augeas木偶类型有一个onlyif属性,它可以让你决定是否将运行与否。 That's pretty much the only conditional option there is for now. 到目前为止,这几乎是唯一的条件选择。

If your need gets quite complex, I'd recommend you write a Ruby augeasprovider instead. 如果您的需求变得非常复杂,建议您改为编写Ruby augeasprovider。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM