On 10/29, Peter Meier wrote:
> > I'm trying to have a exec dependency on a service object that would keep
> > it from being restarted if the exec fails.  Unfortunately, the service
> > gets refreshed regardless whenever the exec is run, failure or not.
[...]
> 
> don't set the command to refreshonly. this will trigger the exec only if
> it get triggered by someone else otherwise the resource counts as
> successful.

That doesn't seem to help.  Here's a simpler test manifest:

        service { dep:
            hasstatus => true, status => "/bin/true status",
            start => "/bin/true start", stop => "/bin/true stop",
            subscribe => File["/tmp/dep"],
            require => Exec["check-dep"],
        }

        exec { "check-dep":
            command => "exit 1",
            path => "/bin",
            subscribe => File["/tmp/dep"],
        }

        file { "/tmp/dep":
            content => "foo",
        }

Shouldn't the "Skipping because of failed dependencies" in the output
below be absolute?  Why is puppet still refreshing the Service[dep]
(in the very next log line)?  Am I misunderstanding how the dependencies
should work?

-j


$ puppet --version
0.24.8
$ puppet --debug dep.pp 
[...]
debug: //Service[dep]/require: requires Exec[check-dep]
debug: //Service[dep]/subscribe: subscribes to File[/tmp/dep]
debug: //Exec[check-dep]/subscribe: subscribes to File[/tmp/dep]
debug: //File[/tmp/dep]: File does not exist
debug: //File[/tmp/dep]/checksum: Initializing checksum hash
debug: //File[/tmp/dep]: Changing content
debug: //File[/tmp/dep]: 1 change(s)
debug: //File[/tmp/dep]: Creating checksum {md5}acbd18db4cc2f85cedef654fccc4a4d8
notice: //File[/tmp/dep]/content: defined 'content' as 
'{md5}acbd18db4cc2f85cedef654fccc4a4d8'
info: //File[/tmp/dep]: Scheduling refresh of Service[dep]
info: //File[/tmp/dep]: Scheduling refresh of Exec[check-dep]
debug: //Exec[check-dep]: Changing returns
debug: //Exec[check-dep]: 1 change(s)
debug: //Exec[check-dep]: Executing 'exit 1'
debug: Executing 'exit 1'
err: //Exec[check-dep]/returns: change from notrun to 0 failed: exit 1 returned 
1 instead of 0 at /home/jlavoie/dep.pp:12
notice: //Exec[check-dep]: Triggering 'refresh' from 1 dependencies
debug: //Exec[check-dep]: Executing 'exit 1'
debug: Executing 'exit 1'
err: //Exec[check-dep]: Failed to call refresh on Exec[check-dep]: exit 1 
returned 1 instead of 0 at /home/jlavoie/dep.pp:12
notice: //Service[dep]: Dependency exec[exit 1] has 1 failures
warning: //Service[dep]: Skipping because of failed dependencies
notice: //Service[dep]: Triggering 'refresh' from 1 dependencies
debug: Service[dep](provider=debian): Executing '/bin/true status'
debug: Service[dep](provider=debian): Executing '/bin/true stop'
debug: Service[dep](provider=debian): Executing '/bin/true start'
debug: Finishing transaction -606555348 with 2 changes


-- 
Jason Lavoie
Ratvarre sbe uver
ja...@oasys.net

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

Reply via email to