On Feb 20, 4:39 am, jimbob palmer <jimbobpal...@gmail.com> wrote: > On Feb 17, 5:22 pm, jimbob palmer <jimbobpal...@gmail.com> wrote: > > > On Feb 17, 5:12 pm, Adam Heinz <a...@metricwise.net> wrote: > > > > Something like this? > > > > exec { "second command": > > > refreshonly => true, > > > subscribe => Exec["first command"], > > > > } > > > Gah! I'm five minutes behind you. It works - THANKS. > > The problem that this creates is that *any* update now runs the > command from the subscribe, which isn't ideal, but I guess will work > for now :)
I don't follow. Do you mean that if any resource at all on the target node is updated by Puppet, then the second Exec runs? That should not be. An Exec marked with "refreshonly => true" should only run if it receives a signal. Or do you mean that the *first* command is executing on every Puppet run? That's not influenced by the DSL fragment you quoted. Here's a complete example that should work: ==== class test::manage_my_file { $my_file = '/tmp/test' $target_string = 'So long, and thanks for all the fish' file { "${my_file}": ensure => 'file' } exec { 'command_one': command => "echo '${target_string}' >> ${my_file}", unless => "grep -q '${target_string}' ${my_file}", require => File["${my_file}"] } exec { 'command_two': command => "/bin/cp ${my_file} /tmp/test2", refreshonly => true, subscribe => Exec[ 'command_one' ] } } node default { include 'test::manage_my_file' } ==== With that as your site.pp (to exclude any possibility of influence by other manifest files), you should see Exec['command_one'] run unless the string "So long, and thanks for all the fish" is present in file / tmp/test on the target node (any target node). If Exec['command_one'] runs then Exec['command_two'] should run after. If Exec['command_one'] *does not* run, then neither should Exec['command_two']. If Exec['command_one'] runs when /tmp/test already contains the target string, or if Exec['command_two'] runs when Exec['command_one'] did not first run in the same session, then you should file a bug report. If this approach does not appear to work when you adapt it to your problem, then do check at least these things: 1) that your 'unless' command is exiting with the expected return code. If it always returns a false (non-zero) exit code then the two execs will always run. 2) that no other resource is set to 'notify' Exec['command_two']. If you use resource defaults anywhere in your configuration then don't forget to check those, too. Also, beware of any resource notifying a collection of Execs, as such a collection could easily include Exec['command_two'] without explicitly naming it. John -- 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.