Tim Stoop
2010-May-20 13:10 UTC
[Puppet Users] Augeas in puppet behaves differently than augtool?
Hi all, I''m trying to do fairly simple stuff with augeas, like: augeas { "cronapt - mailon": context => "/files/etc/cron-apt/config", changes => "set MAILON upgrade", onlyif => "match MAILON != [''upgrade'']", } This works if I try it from the commandline: tim@puppet-test.db:~$ sudo augtool augtool> set /files/etc/cron-apt/config/MAILON update augtool> save Saved 1 file(s) augtool> However, when I try to do this from puppet, the whole files get emptied out, only the one expected line get added (MAILON=upgrade) and puppet reports and error: debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Opening augeas with root /, lens path /usr/local/share/augeas/lenses:/ usr/share/augeas/lenses/dist, flags 0 debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Augeas version 0.7.0 is installed debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Will attempt to save and only run if files changed debug: Augeas[dummy - cron-apt change mailon](provider=augeas): sending command ''set'' with params ["/files/etc/cron-apt/config/ MAILON", "upgrade"] debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Files changed, should execute debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Closed the augeas connection debug: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Augeas[dummy - cron-apt change mailon]: Changing returns debug: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Augeas[dummy - cron-apt change mailon]: 1 change(s) debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Opening augeas with root /, lens path /usr/local/share/augeas/lenses:/ usr/share/augeas/lenses/dist, flags 0 debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Augeas version 0.7.0 is installed debug: Augeas[dummy - cron-apt change mailon](provider=augeas): sending command ''set'' with params ["/files/etc/cron-apt/config/ MAILON", "upgrade"] debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Closed the augeas connection err: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Augeas[dummy - cron-apt change mailon]/returns: change from need_to_run to 0 failed: Save failed with return code false notice: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Line[Augeas change tracking for ''dummy - cron-apt change mailon'']/Exec[line Augeas change tracking for ''dummy - cron-apt change mailon'']: Dependency augeas[dummy - cron-apt change mailon] has 1 failures warning: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron-apt change mailon]/Line[Augeas change tracking for ''dummy - cron- apt change mailon'']/Exec[line Augeas change tracking for ''dummy - cron- apt change mailon'']: Skipping because of failed dependencies Is anyone able to shed some light on the issue? This is puppetmasterd and puppet 0.25.5rc3, by the way. Using libaugeas-ruby1.8 0.3.0-1~bpo50+1 on Debian Lenny. -- Kind regards, Tim -- 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 http://groups.google.com/group/puppet-users?hl=en.
Patrick
2010-May-20 15:26 UTC
Re: [Puppet Users] Augeas in puppet behaves differently than augtool?
On May 20, 2010, at 6:10 AM, Tim Stoop wrote:> Hi all, > > I''m trying to do fairly simple stuff with augeas, like: > > augeas { "cronapt - mailon": > context => "/files/etc/cron-apt/config", > changes => "set MAILON upgrade", > onlyif => "match MAILON != [''upgrade'']", > } > > This works if I try it from the commandline: > > tim@puppet-test.db:~$ sudo augtool > augtool> set /files/etc/cron-apt/config/MAILON update > augtool> save > Saved 1 file(s) > augtool> > > However, when I try to do this from puppet, the whole files get > emptied out, only the one expected line get added (MAILON=upgrade) and > puppet reports and error:What are you trying to do with the onlyif? If that works in augtool, and that''s what you want, just remove the onlyif. -- 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 http://groups.google.com/group/puppet-users?hl=en.
Tim Stoop
2010-May-20 18:36 UTC
[Puppet Users] Re: Augeas in puppet behaves differently than augtool?
On 20 mei, 17:26, Patrick <kc7...@gmail.com> wrote:> What are you trying to do with the onlyif? If that works in augtool, and that''s what you want, just remove the onlyif.Without the onlyif, I''m still getting the error: debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Opening augeas with root /, lens path /usr/local/share/augeas/lenses:/ usr/share/augeas/lenses/dist, flags 0 debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Augeas version 0.7.0 is installed debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Will attempt to save and only run if files changed debug: Augeas[dummy - cron-apt change mailon](provider=augeas): sending command ''set'' with params ["/files/etc/cron-apt/config/ MAILON", "upgrade"] debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Files changed, should execute debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Closed the augeas connection debug: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Augeas[dummy - cron-apt change mailon]: Changing returns debug: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Augeas[dummy - cron-apt change mailon]: 1 change(s) debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Opening augeas with root /, lens path /usr/local/share/augeas/lenses:/ usr/share/augeas/lenses/dist, flags 0 debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Augeas version 0.7.0 is installed debug: Augeas[dummy - cron-apt change mailon](provider=augeas): sending command ''set'' with params ["/files/etc/cron-apt/config/ MAILON", "upgrade"] debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Closed the augeas connection err: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Augeas[dummy - cron-apt change mailon]/returns: change from need_to_run to 0 failed: Save failed with return code false notice: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- apt change mailon]/Line[Augeas change tracking for ''dummy - cron-apt change mailon'']/Exec[line Augeas change tracking for ''dummy - cron-apt change mailon'']: Dependency augeas[dummy - cron-apt change mailon] has 1 failures warning: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron-apt change mailon]/Line[Augeas change tracking for ''dummy - cron- apt change mailon'']/Exec[line Augeas change tracking for ''dummy - cron- apt change mailon'']: Skipping because of failed dependencies I thought I needed the onlyif to prevent it from applying every run. -- Kind regards, Tim -- 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 http://groups.google.com/group/puppet-users?hl=en.
Patrick
2010-May-20 21:11 UTC
Re: [Puppet Users] Re: Augeas in puppet behaves differently than augtool?
On May 20, 2010, at 11:36 AM, Tim Stoop wrote:> > > On 20 mei, 17:26, Patrick <kc7...@gmail.com> wrote: >> What are you trying to do with the onlyif? If that works in augtool, and that''s what you want, just remove the onlyif. > > Without the onlyif, I''m still getting the error: > > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): > Opening augeas with root /, lens path /usr/local/share/augeas/lenses:/ > usr/share/augeas/lenses/dist, flags 0 > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Augeas > version 0.7.0 is installed > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Will > attempt to save and only run if files changed > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): > sending command ''set'' with params ["/files/etc/cron-apt/config/ > MAILON", "upgrade"] > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Files > changed, should execute > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Closed > the augeas connection > debug: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- > apt change mailon]/Augeas[dummy - cron-apt change mailon]: Changing > returns > debug: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- > apt change mailon]/Augeas[dummy - cron-apt change mailon]: 1 change(s) > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): > Opening augeas with root /, lens path /usr/local/share/augeas/lenses:/ > usr/share/augeas/lenses/dist, flags 0 > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Augeas > version 0.7.0 is installed > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): > sending command ''set'' with params ["/files/etc/cron-apt/config/ > MAILON", "upgrade"] > debug: Augeas[dummy - cron-apt change mailon](provider=augeas): Closed > the augeas connection > err: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- > apt change mailon]/Augeas[dummy - cron-apt change mailon]/returns: > change from need_to_run to 0 failed: Save failed with return code > false > notice: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - cron- > apt change mailon]/Line[Augeas change tracking for ''dummy - cron-apt > change mailon'']/Exec[line Augeas change tracking for ''dummy - cron-apt > change mailon'']: Dependency augeas[dummy - cron-apt change mailon] has > 1 failures > warning: //kbp_debian/Cronapt::Config[dummy]/Augeas::Apply[dummy - > cron-apt change mailon]/Line[Augeas change tracking for ''dummy - cron- > apt change mailon'']/Exec[line Augeas change tracking for ''dummy - cron- > apt change mailon'']: Skipping because of failed dependencies > > I thought I needed the onlyif to prevent it from applying every run. >It will only apply it if the command results in a file(s) being changed. That means you often need it for insert statements, but almost never need it for set statements. That''s strange. Can you post a copy of the cron-apt config file? I''d like to play around with it and see if I get the same problem. -- 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 http://groups.google.com/group/puppet-users?hl=en.
Tim Stoop
2010-May-21 08:32 UTC
[Puppet Users] Re: Augeas in puppet behaves differently than augtool?
Hi Patrick, On 20 mei, 23:11, Patrick <kc7...@gmail.com> wrote:> That''s strange. Can you post a copy of the cron-apt config file? I''d like to play around with it and see if I get the same problem.I can, but it''s so simple, I''m not even going to bother :) The default config file is everything commented out. That''s it. So a file full of lines starting with # :) I made a lens that just uses the default Shellvars.lns without modifications except for the path. -- Kind regards, Tim -- 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 http://groups.google.com/group/puppet-users?hl=en.
Tim Stoop
2010-May-21 13:21 UTC
[Puppet Users] Re: Augeas in puppet behaves differently than augtool?
Hi all, To expand on this, I tried it from the irb: tim@puppet-test.db:~/augeas/lenses$ sudo irb irb(main):001:0> require ''augeas'' => true irb(main):002:0> Augeas::open do |aug| irb(main):003:1* aug.set("/files/etc/cron-apt/config/ MAILON","upgrade") irb(main):004:1> unless aug.save irb(main):005:2> raise IOError, "Failed to save changes" irb(main):006:2> end irb(main):007:1> end => nil irb(main):008:0> But the puppet recipe still goes wrong. Any ideas? -- Kind regards, Tim -- 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 http://groups.google.com/group/puppet-users?hl=en.
Tim Stoop
2010-May-21 13:38 UTC
[Puppet Users] Re: Augeas in puppet behaves differently than augtool?
Hi all, Okay, I found it, but I cannot explain what''s happening here. Hope someone else can. I was adding a load_patch with value "/usr/local/share/augeas/lenses". When I add that, I get the error. If I leave it out, it works. However, I have no idea how Augeas knows that it should be searching / usr/local/share/augeas/lenses. For the record, load_path seemed to work as expected in 0.25.4. Not sure what changed it. -- Kind regards, Tim -- 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 http://groups.google.com/group/puppet-users?hl=en.
Tim Stoop
2010-May-21 14:05 UTC
[Puppet Users] Re: Augeas in puppet behaves differently than augtool?
Hi all, Finally found my problem. Apparantly, the default shellvars.aug lens already includes the config to make it apply to /etc/cron-apt/config. When I added my cronapt.aug custom lens, there was a clash of two lenses telling augeas they were applicable on the same file. So, PEBKAC. Apologies for the noise. -- Kind regards, Tim -- 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 http://groups.google.com/group/puppet-users?hl=en.