如何在人偶中使用setm [英] How to use setm in puppet

查看:113
本文介绍了如何在人偶中使用setm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Puppet中的 setm 命令更改一个属性名称(" modcluster.proxylist ").我的以下代码无法正常工作.非常感谢您的帮助.

I would like to change a one property name ( "modcluster.proxylist" ) with setm Command in Puppet. My following code is not working. Any help is much appreciated.

    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.

Following is my Source XML which i would like to change.

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

推荐答案

其中存在很多问题.让我们一一处理它们:

There's quite a few problems in there. Let's deal with them one by one:

  • 您提供的domain.xml代码似乎是错误的,因为没有Puppet代码提示的domainserver-groups节点.我认为围绕您提供的代码还有两个层次:

  • it seems the domain.xml code you provide is wrong, as there's no domain and server-groups nodes as your Puppet code suggests. I take it there's two more levels around the code you provided:

<domain>
  <server-groups>
    <!-- the rest of the file -->
  <server-groups>
<domain>

  • 使用incllens时无需设置context,它是自动的

  • there's no need to set context when using incl and lens, it's automatic

    结果如下:

    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",
     }
    

    这篇关于如何在人偶中使用setm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆