[Puppet Users] Puppet & Augeas

Kris Buytaert
Mon, 06 Jun 2011 09:01:02 -0000

I`m struggling with getting puppet to do do an agueas run correctly.

When I make the modifications using augtool on the cli
Everything works like expected .




augtool  --noload
augtool>
set /augeas/load/Xml/incl[last()+1]
/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml
augtool>  load
augtool>
set
/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[16]/#attribute/value
10.0.0.2
augtool>
set
/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[17]/#attribute/value
10.0.0.2
augtool> save
Saved 1 file(s)


 cat sipX_profile.xml  | grep 10


    <!--<param name="enable-100rel"
value="true"/>-->






When I try to do the same from puppet ..


augeas{"sipxprofile" :
        changes => [

"set /augeas/load/Xml/incl[last()+1]
/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml",

"set
/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[16]/#attribute/value
10.0.0.2",

"set
/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml/profile/settings/param[17]/#attribute/value
10.0.0.2",
        ],
        }

I''ve noticed different behaviour ranging from only the changed code to
be written to disk rather than the whole file.

 cat sipX_profile.xml
<profile><settings><param
value="10.0.0.2">

</settings>
</profile>

To actual errors  "change from need_to_run to 0 failed: Save failed with
return code false" when trying to experiment with a syntax like below.
...
augeas{"sipxprofile" :
        lens    => "Xml",
        incl    =>
"/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml",
        context =>
"/files/etc/sipxpbx/freeswitch/conf/sip_profiles/sipX_profile.xml",
        changes => [
          "set profile/settings/param[16]/#attribute/value 10.0.0.2",
          "set profile/settings/param[17]/#attribute/value 10.0.0.2",
        ],
}



Is there some way to implement the "load" function in augeas in puppet
?
Or any documentation around regarding the correct use of lens, incl
etc ?


thnx in advance

Kris


--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at