Arnau Bria
2009-Jul-15 12:58 UTC
[Puppet Users] executing some code with subscribe/notify/unless
Hi all,
I have some code to execute that depends on two things:
1.-) some file is modified
2.-) its log shows some error.
So I''d like to define both conditions, and I''ve done it like:
file { "file1":
recurse => true,
owner => "root",
group => "root",
mode => "700",
source => "puppet://server/file1",
notify => Exec["refresh_conf"],
}
exec { "refresh_conf":
command => "exec something",
#subscribe => File["file1"],
timeout => "-1",
#unless => "condition1",
}
So now I have subscribe and unless commented. subscribe because I added
notify on file1, and unless cause if file1 notifies to refresh it
evaluates conditon1 and,as log is fine, the exec is not refreshed.
So, how may I tell refresh_conf to execute itself depending in those two
conditions?
TIA,
Arnau
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
David Schmitt
2009-Jul-15 13:43 UTC
[Puppet Users] Re: executing some code with subscribe/notify/unless
Arnau Bria wrote:> Hi all, > > I have some code to execute that depends on two things: > > 1.-) some file is modified > > 2.-) its log shows some error. > > So I''d like to define both conditions, and I''ve done it like: > > file { "file1": > recurse => true, > owner => "root", > group => "root", > mode => "700", > source => "puppet://server/file1", > notify => Exec["refresh_conf"], > } > > > exec { "refresh_conf": > command => "exec something", > #subscribe => File["file1"], > timeout => "-1", > #unless => "condition1", > } > > So now I have subscribe and unless commented. subscribe because I added > notify on file1, and unless cause if file1 notifies to refresh it > evaluates conditon1 and,as log is fine, the exec is not refreshed. > > So, how may I tell refresh_conf to execute itself depending in those two > conditions? >Have you tried setting the "refreshonly" parameter on the Exec? Regards, DavidS --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Arnau Bria
2009-Jul-15 14:55 UTC
[Puppet Users] Re: executing some code with subscribe/notify/unless
On Wed, 15 Jul 2009 15:43:37 +0200 David Schmitt wrote: Hi David,> Have you tried setting the "refreshonly" parameter on the Exec?yes I did, but, IIRC, my problem is still there, cause it evaluates the unless and nothing is done as log is clear. file''s notify does its work, but I don''t see how to add my second condition (if log has errors) to code...> Regards, DavidSCheers, Arnau --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---