On 12/30/2012 07:53 AM, Erik Dalén wrote:
Wouldn't it be easier to use a service definition with the base provider
and supply your start, restart & status commands?


On 30 December 2012 03:27, Jason Edgecombe <[email protected]> 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 2f840fdf8acf7c334c293c9da08797**21
/Stage[main]//Buildbot::Slave:**:Instance[openafs1]/File[/**
home/buildslave/buildbot/**openafs/info/admin]/content: content changed
'{md5}**2f840fdf8acf7c334c293c9da08797**21' to '{md5}**
18eca080dfec8ff8fc47a54bf6a962**26'
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 [email protected].
To unsubscribe from this group, send email to puppet-users+unsubscribe@**
googlegroups.com <puppet-users%[email protected]>.
For more options, visit this group at http://groups.google.com/**
group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en>
.



I've thought about that. This is a basically a service, but I can have multiple instances of the process running with different configurations. As I understand, I would need to create a new service script for each instance.

Jason

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to