I think it's the expected behavior...

My reading is that if you want Exec["exec-DDD"] being run only when
Exec["exec-CCC"] have run, and at the same time, Exec["exec-CCC"] has
refreshonly attribute, then it's not require the way, it's set it to
refreshonly and tell Exec["exec-CCC"] to notify Exec["exec-DDDD"].

When you require exec-CCC from exec-DDD, puppet will make sure of place
exec-CCC before exec-DDD, but if exec-CCC does not run, be it for a ifonly
non true, be it for been a refreshonly type without notice, it will
continue anyway.

Metaparameters page (
http://docs.puppetlabs.com/references/stable/metaparameter.html) says:
>
> This is used purely for guaranteeing that changes to required objects
happen before the dependent object"
>

The word "happen" here is tricky, I would say then than happen means "are
parsed and run if needed".

Or... I'm more lost than I thought with puppet and my english still sucks :)

Cheers

Guzman

On Tue, Oct 2, 2012 at 9:32 PM, Miguel Di Ciurcio Filho <
miguel.fi...@gmail.com> wrote:

> On Tue, Oct 2, 2012 at 5:36 PM, am-aaron <aaron.dso...@ammeon.com> wrote:
> >
> > exec { "exec-AAA":
> >   command => "/bin/true",
> >   returns => 0,
> >   notify  => Exec["exec-BBB"],
> > }
> > exec { "exec-BBB":
> >   refreshonly => true,
> >   command     => "/bin/false",
> >   returns     => 0,
> >   notify      => Exec["exec-CCC"],
> > }
> > exec { "exec-CCC":
> >   refreshonly => true,
> >   command     => "/bin/touch /tmp/CCC",
> >   returns     => 0,
> > }
> >
> > exec { "exec-DDD":
> >   require => Exec["exec-CCC"],
> >   command => "/bin/true",
> >   returns => 0,
> >   notify  => Exec["exec-EEE"],
> > }
>
> I tested your code and indeed, it is a strange behavior.
>
> I guess the root cause of the problem is the `refreshonly => true` of
> exec-CCC.
>
> My reading of the situation:
> - exec-BBB runs and fails, sending nothing to exec-CCC.
> - exec-CCC has `refreshonly => true`, since exec-BBB has failed, it
> does nothing.
> - exec-DDD runs, even having `require => Exec['exec-CCC']` which has
> not received a notify because exec-BBB failed.
>
> I did a test using the chaining syntax and the behavior is the same:
>
> Exec['exec-AAA'] ~> Exec['exec-BBB'] ~> Exec['exec-CCC'] ->
> Exec['exec-DDD']
>
> # puppet apply test.pp
> /Stage[main]//Exec[exec-AAA]/returns: executed successfully
> Error: /Stage[main]//Exec[exec-BBB]: Failed to call refresh:
> /bin/false returned 1 instead of one of [0]
> Error: /Stage[main]//Exec[exec-BBB]: /bin/false returned 1 instead of one
> of [0]
> /Stage[main]//Exec[exec-DDD]/returns: executed successfully
>
> Exec['exec-CCC'] does not receive a notification and does not run
> because exec-BBB failed. Although, it fulfills the `require`
> relationship with Exec['exec-DDD'], which runs.
>
> Note: changing the relationship of Exec['exec-CCC'] and
> Exec['exec-DDD'] from `require` para `notify` does not solve the
> problem, the behavior is the same.
>
> Very odd. The documentation about `exec` does not say anything about
> this behavior of `refreshonly` [1].
>
> [1] http://docs.puppetlabs.com/references/stable/type.html#exec
>
> --
> 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.
>
>


-- 
GuruHub - Guzmán Brasó
http://www.guruhub.com.uy - +59898674020
Rivera 3565 - CP11400 - Montevideo, Uruguay

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