Thanks, that worked!

On 12/29/2012 09:38 PM, Maarten Thibaut (mthibaut) wrote:
Hi,

I believe the onlyif "wins" in this case. Splitting it up into two statements 
would  be the right thing to do IMO.

It would also be cleaner, since they are in effect two different cases: stopped 
(and in need of starting), and running (but in need of restart).

The fact that these both run the same command is incidental. Don't think 
low-level, think high-level!

Sent from my iPhone

On 30 Dec 2012, at 03:27, "Jason Edgecombe" <ja...@rampaginggeek.com> wrote:

Hi,

I'm having trouble with an exec type. I'm using an exec type to start a buildbot slave. It's a long-running 
pseudo-service. The exec uses the "refresh" and "onlyif". I think that the refresh 
command isn't running because of the onlyif attribute. I would like a refresh event to fire even if the 
"onlyif" attribute is in use. Any help is appreciated. Do I need to split it into two exec's (one 
normal and another refreshonly)?


Here is a snippet from the type definition:
==============
define buildbot::slave::instance( ..., $project_dir, ... ) {

  $path                  = ['/usr/local/bin','/usr/bin','/bin']
  $config_files          = ["$project_dir/info/admin","$project_dir/info/host"]

  # commands to work with the buildslave
  $slave_install_command = "buildslave create-slave $project_dir $master_host_port 
$slave_name $slave_password"
  $slave_start_command   = "buildslave start $project_dir"
  $slave_restart_command = "buildslave restart $project_dir"
  $slave_status_command  = "/bin/kill -0 `/bin/cat $project_dir/twistd.pid`"

...snip...

  exec { $slave_start_command:
    cwd       => $project_dir,
    path      => $path,
    user      => $user,
    group     => $group,
    unless    => $slave_status_command,
    refresh   => $slave_restart_command,
    require   => File[$config_files],
    subscribe => File[$config_files],
  }
======
Here is part of the debug log:

Info: 
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]:
 Filebucketed /home/buildslave/buildbot/openafs/info/ad
min to puppet with sum 2f840fdf8acf7c334c293c9da0879721
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]/content:
 content changed '{md5}2f840fdf8acf7c334c293c9da0879721' to 
'{md5}18eca080dfec8ff8fc47a54bf6a96226'
Info: 
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]:
 Scheduling refresh of Exec[buildslave start /home/buildslave/buildbot/openafs]
Debug: 
/Stage[main]//Buildbot::Slave::Instance[openafs1]/File[/home/buildslave/buildbot/openafs/info/admin]:
 The container Buildbot::Slave::Instance[openafs1] will propagate my refresh 
event
Debug: Exec[buildslave start 
/home/buildslave/buildbot/openafs](provider=posix): Executing check '/bin/kill 
-0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
Debug: Executing '/bin/kill -0 `/bin/cat 
/home/buildslave/buildbot/openafs/twistd.pid`'
Debug: Exec[buildslave start 
/home/buildslave/buildbot/openafs](provider=posix): Executing check '/bin/kill 
-0 `/bin/cat /home/buildslave/buildbot/openafs/twistd.pid`'
Debug: Executing '/bin/kill -0 `/bin/cat 
/home/buildslave/buildbot/openafs/twistd.pid`'
/Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave start 
/home/buildslave/buildbot/openafs]: Triggered 'refresh' from 1 events
Debug: /Stage[main]//Buildbot::Slave::Instance[openafs1]/Exec[buildslave start 
/home/buildslave/buildbot/openafs]: The container 
Buildbot::Slave::Instance[openafs1] will propagate my refresh event
Debug: Buildbot::Slave::Instance[openafs1]: The container Class[Main] will 
propagate my refresh event
Debug: Class[Main]: The container Stage[main] will propagate my refresh event


Thanks,
Jason

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


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