Ok, the error's are still the same with puppet-0.24.8. But I had to change the way I quoted args in changes lines for it to work.
If I use an [.='somevalue'] def in an augeas changes var in puppet I'm still getting: change from need_to_run to 0 failed: Save failed with return code false I have checked the changes string I am using in augtool again and it saves ok, but the libruby-augeas bindings provide only true and false as options for augeas_save() and no extra information as to what is going wrong. - Karl On Tue, Apr 7, 2009 at 10:41 PM, Karl Bowden <karlbow...@gmail.com> wrote: > Sorry, my statements could have been clearer. > > The example you listed works great in augtool. It was just the syntax > I hoped for. > > It seems that puppet is balking on the /dir[.='/path'] syntax though. > Only on the second augeas run when the changes get applied to the > filesystem as the log files correctly state that there is 1 change to > apply, but fails to write the change on the second run. > It also reports the invalid command error when I include the remove > (or rm) statement. > > So it seems to now be a bug in puppet. I'm just packaging 0.24.8 for > ubuntu to retest. I'm currently using: > puppet-0.24.7 > augeas-0.5.0 > libruby-augeas-0.2.0 > > - Karl > > On Tue, Apr 7, 2009 at 10:24 PM, Bryan Kearney <bkear...@redhat.com> wrote: >> >> Just checking if these came out of order. Is this working or not for you? >> >> -- bk >> >> Karl Bowden wrote: >>> On Tue, Apr 7, 2009 at 11:46 AM, Karl Bowden <karlbow...@gmail.com> wrote: >>>> On Mon, Apr 6, 2009 at 11:59 PM, Bryan Kearney <bkear...@redhat.com> wrote: >>>>> agentk wrote: >>>>>> I'm not sure if I'm kicking tyres again, but first off: I like the >>>>>> possibilities with puppet + augeas. >>>>>> >>>>>> Trying to make a working example with /etc/exports but not sure of how >>>>>> to proceed. I want to be able to define exports in the following form: >>>>>> >>>>>> my_exports_def { >>>>>> ['/home/server01', '/svr/logs']: >>>>>> client => '*.example.com', >>>>>> options => 'rw,sync', >>>>>> '/other/export': >>>>>> client => '*.example.com', >>>>>> options => 'rw,sync,no_root_squash', >>>>>> } >>>>>> >>>>> Try something like this: >>>>> >>>>> augeas{"test": >>>>> context=>"/files/etc/exports", >>>>> changes => ["set /dir[.='/home/server01'] '/home/server01'", >>>>> "set /dir[.='/home/server01']/client '*.example.com'", >>>>> "set >>>>> /dir[.='/home/server01']/client[.='*.example.com']/option[.='rw'] rw"] >>>>> >>>>> } >>>>> >>>>> The commands work in augtool. The iteration may be an issue if you have >>>>> many options. Perhaps you can set that up in a wrapper call and use >>>>> conditionals? >>>>> >>>>> -- bk >>>> Cheers! Your example did not work at first, but I just needed to >>>> package the latest augeas for ubuntu. I think that is where half of my >>>> trouble was. Oh well. All good now thank you. >>>> >>>> - Karl >>>> >>> >>> Ok, I'm almost there. But not quite. >>> >>> First here is the code I'm using: >>> >>> templates/augeas/exports.erb: >>> set /dir[.='<%= name %>'] '<%= name %>' >>> set /dir[.='<%= name %>']/client[.='<%= client %>'] '<%= client %>' >>> remove /dir[.='<%= name %>']/client[.='<%= client %>']/option >>> <% options.each do |option| %>set /dir[.='<%= name %>']/client[.='<%= >>> client %>']/option[.='<%= option %>'] '<%= option %>' >>> <% end %> >>> >>> manifests/templates.pp: >>> define augeas_nfs_export($client='*', $options=['ro','sync']) { >>> augeas { >>> "$name": >>> context => "/files/etc/exports", >>> changes => template('augeas/exports.erb'), >>> } >>> } >>> class virt02_export { >>> augeas_nfs_export { >>> '/home/server01': >>> client => '*.example.com', >>> options => ['rw','sync','no_subtree_check']; >>> } >>> } >>> >>> Now the debug output shows that puppets is producing the right augeas >>> commands and the work in augtool when I run the manually, but I have >>> not been able to get puppet to save /etc/exports >>> >>> Trimed log output from sudo puppetd --test --debug: >>> debug: >>> //Node[virt02.nugan.com.au]/virt02_export/Augeas_nfs_export[/home/server01]/Augeas[/home/server01]: >>> Changing returns >>> debug: >>> //Node[virt02.nugan.com.au]/virt02_export/Augeas_nfs_export[/home/server01]/Augeas[/home/server01]: >>> 1 change(s) >>> debug: Augeas[/home/server01](provider=augeas): Opening augeas with >>> root /, lens path , flags 0 >>> debug: Augeas[/home/server01](provider=augeas): sending command 'set' >>> with params ["/files/etc/exports/dir[.='/home/server01']", >>> "'/home/server01'"] >>> debug: Augeas[/home/server01](provider=augeas): sending command 'set' >>> with params >>> ["/files/etc/exports/dir[.='/home/server01']/client[.='*.example.com']", >>> "'*.example.com'"] >>> debug: Augeas[/home/server01](provider=augeas): sending command >>> 'remove' with params >>> ["/files/etc/exports/dir[.='/home/server01']/client[.='*.example.com']/option"] >>> debug: Augeas[/home/server01](provider=augeas): sending command 'set' >>> with params >>> ["/files/etc/exports/dir[.='/home/server01']/client[.='*.example.com']/option[.='rw']", >>> "'rw'"] >>> debug: Augeas[/home/server01](provider=augeas): sending command 'set' >>> with params >>> ["/files/etc/exports/dir[.='/home/server01']/client[.='*.example.com']/option[.='sync']", >>> "'sync'"] >>> debug: Augeas[/home/server01](provider=augeas): sending command 'set' >>> with params >>> ["/files/etc/exports/dir[.='/home/server01']/client[.='*.example.com']/option[.='no_subtree_check']", >>> "'no_subtree_check'"] >>> err: >>> //Node[virt02.nugan.com.au]/virt02_export/Augeas_nfs_export[/home/server01]/Augeas[/home/server01]/returns: >>> change from need_to_run to 0 failed: invalid command >>> >>> The first two lines indicate to me that puppet is seeing that on the >>> test run augeas has one line to change in exports, but always fails on >>> the actual run. >>> Also to not is the remove command seems to produce errors on the final >>> run too. if I remove the remove line the error is: >>> err: >>> //Node[virt02.nugan.com.au]/virt02_export/Augeas_nfs_export[/home/server01]/Augeas[/home/server01]/returns: >>> change from need_to_run to 0 failed: Save failed with return code >>> false >>> >>> I have tried putting these commands directly into an augeas statement, >>> but it still produces the same errors. Where do I look next? >>> >>> - Karl >>> >>> > >> >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---