hello:

i currently am using Puppet to run some commands in a sequence. there are 
two sequences of exec resources. we found that we cannot use require => 
Exec and it does not work at all as expected. here is some sample code.

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"],
}
exec { "exec-EEE":
  refreshonly => true,
  command     => "/bin/false",
  notify      => Exec["exec-FFF"],
}
exec { "exec-FFF":
  refreshonly => true,
  command     => "/bin/touch /tmp/FFF",
  returns     => 0,
}

*ms1:/root/aaron> puppet apply t1.pp*

notice: /Stage[main]//Exec[exec-AAA]/returns: executed successfully
err: /Stage[main]//Exec[exec-BBB]: Failed to call refresh: /bin/false 
returned 1 instead of one of [0] at /root/aaron/t1.pp:11
notice: /Stage[main]//Exec[exec-DDD]/returns: executed successfully
err: /Stage[main]//Exec[exec-EEE]: Failed to call refresh: /bin/false 
returned 1 instead of one of [0] at /root/aaron/t1.pp:28
notice: Finished catalog run in 0.36 seconds

in the example above, how did Exec["exec-DDD"] run when Exec["exec-CCC"] 
did not run and Exec["exec-DDD"] require Exec["exec-CCC"]?

*ms1:/root/aaron> puppet apply --debug t1.pp*

info: Applying configuration version '1349209769'
debug: /Stage[main]//Exec[exec-DDD]/require: requires Exec[exec-CCC]
debug: /Stage[main]//Exec[exec-DDD]/notify: subscribes to Exec[exec-EEE]
debug: /Stage[main]//Exec[exec-BBB]/notify: subscribes to Exec[exec-CCC]
debug: /Stage[main]//Exec[exec-AAA]/notify: subscribes to Exec[exec-BBB]
debug: /Stage[main]//Exec[exec-EEE]/notify: subscribes to Exec[exec-FFF]
debug: /Schedule[never]: Skipping device resources because running on a host
debug: /Schedule[daily]: Skipping device resources because running on a host
debug: /Schedule[monthly]: Skipping device resources because running on a 
host
debug: /Schedule[puppet]: Skipping device resources because running on a 
host
debug: /Schedule[hourly]: Skipping device resources because running on a 
host
debug: /Schedule[weekly]: Skipping device resources because running on a 
host
debug: Exec[exec-AAA](provider=posix): Executing '/bin/true'
debug: Executing '/bin/true'
notice: /Stage[main]//Exec[exec-AAA]/returns: executed successfully
debug: /Stage[main]//Exec[exec-AAA]: The container Class[Main] will 
propagate my refresh event
info: /Stage[main]//Exec[exec-AAA]: Scheduling refresh of Exec[exec-BBB]
debug: Exec[exec-BBB](provider=posix): Executing '/bin/false'
debug: Executing '/bin/false'
err: /Stage[main]//Exec[exec-BBB]: Failed to call refresh: /bin/false 
returned 1 instead of one of [0] at /root/aaron/t1.pp:11
debug: Exec[exec-DDD](provider=posix): Executing '/bin/true'
debug: Executing '/bin/true'
notice: /Stage[main]//Exec[exec-DDD]/returns: executed successfully
debug: /Stage[main]//Exec[exec-DDD]: The container Class[Main] will 
propagate my refresh event
info: /Stage[main]//Exec[exec-DDD]: Scheduling refresh of Exec[exec-EEE]
debug: Exec[exec-EEE](provider=posix): Executing '/bin/false'
debug: Executing '/bin/false'
err: /Stage[main]//Exec[exec-EEE]: Failed to call refresh: /bin/false 
returned 1 instead of one of [0] at /root/aaron/t1.pp:28
debug: Class[Main]: The container Stage[main] will propagate my refresh 
event
debug: Finishing transaction 70054935787440
debug: Storing state
debug: Stored state in 0.06 seconds
notice: Finished catalog run in 0.37 seconds
debug: /File[/var/lib/puppet/rrd]/seluser: Found seluser default 'system_u' 
for /var/lib/puppet/rrd
debug: /File[/var/lib/puppet/rrd]/selrole: Found selrole default 'object_r' 
for /var/lib/puppet/rrd
debug: /File[/var/lib/puppet/rrd]/seltype: Found seltype default 
'puppet_var_lib_t' for /var/lib/puppet/rrd
debug: /File[/var/lib/puppet/rrd]/selrange: Found selrange default 's0' for 
/var/lib/puppet/rrd
debug: Finishing transaction 70054934905120
debug: Recieved report to process from ms1
debug: Processing report from ms1 with processor Puppet::Reports::Store

as you can see in the debug run, even though Exec["exec-DDD"] require 
Exec["exec-CCC"], and the latter does not run, the former runs. what is 
going on here?

thank you for your time.

have a nice day,

Aaron
--
{<-encapsulation->}


-- 
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
If you have received this email in error please notify the system manager. 
This message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/ZGvw-FpTjqAJ.
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