| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 # == Type: buildbot::slave | 
|  | 2 # | 
|  | 3 # Manage Buildbot (http://buildbot.net/) slave instances. | 
|  | 4 # | 
|  | 5 # === Parameters: | 
|  | 6 # | 
|  | 7 # [*basedir*] | 
|  | 8 #   The base directory of the slave, which can be configured elsewhere or, | 
|  | 9 #   if it's anchestors are present, relied upon the builtin defaults. | 
|  | 10 # | 
|  | 11 # [*ensure*] | 
|  | 12 #   Whether to setup the slave (anything but 'absent' or 'purged') or | 
|  | 13 #   remove the associated resources. Note that only 'purged' implies the | 
|  | 14 #   removal of $basedir. | 
|  | 15 # | 
|  | 16 # [*master*] | 
|  | 17 #   The "$hostname:$port" combination of the build master. | 
|  | 18 # | 
|  | 19 # [*name*] | 
|  | 20 #   The build slave's name. | 
|  | 21 # | 
|  | 22 # [*password*] | 
|  | 23 #   The build slave's password with the master. | 
|  | 24 # | 
|  | 25 # [*system*] | 
|  | 26 #   Any value beside 'false' will cause the slave operations to also | 
|  | 27 #   affect the buildbot::buildslave service. Use this option to include | 
|  | 28 #   the slave instance with the system daemon. | 
|  | 29 # | 
|  | 30 # [*user*] | 
|  | 31 #   The user to whom the slave instance belongs to. Note that the user | 
|  | 32 #   is not created implicitly by this setup, except if the creation is | 
|  | 33 #   implied with any of the $buildbot::slave_packages. | 
|  | 34 # | 
|  | 35 # === Examples: | 
|  | 36 # | 
|  | 37 #   buildbot::slave {'alpha': | 
|  | 38 #     basedir => '/var/buildslave-alpha', | 
|  | 39 #   } | 
|  | 40 # | 
|  | 41 #   buildbot::slave {'beta': | 
|  | 42 #     ensure => absent, | 
|  | 43 #   } | 
|  | 44 # | 
|  | 45 define buildbot::slave ( | 
|  | 46   $admin = 'buildbot@localhost', | 
|  | 47   $basedir = "$::buildbot::slave_directory/$name", | 
|  | 48   $ensure = 'present', | 
|  | 49   $master = 'localhost:9989', | 
|  | 50   $password = 'changeme', | 
|  | 51   $system = false, | 
|  | 52   $user = $::buildbot::slave_user, | 
|  | 53 ) { | 
|  | 54 | 
|  | 55   if $ensure !~ /^(absent|purged)$/ { | 
|  | 56     ensure_packages($::buildbot::slave_packages) | 
|  | 57     realize(File[$::buildbot::slave_directory]) | 
|  | 58 | 
|  | 59     exec {"buildslave#$title": | 
|  | 60       command => shellquote([ | 
|  | 61         $::buildbot::slave_runner, | 
|  | 62         'create-slave', | 
|  | 63         $basedir, | 
|  | 64         $master, | 
|  | 65         $name, | 
|  | 66         $password, | 
|  | 67       ]), | 
|  | 68       creates => "$basedir/buildbot.tac", | 
|  | 69       require => [ | 
|  | 70         File[$::buildbot::master_directory], | 
|  | 71         Package[$::buildbot::master_packages], | 
|  | 72       ], | 
|  | 73       user => $user, | 
|  | 74     } | 
|  | 75 | 
|  | 76     Exec["buildslave#$title"] <- Exec <|creates == $basedir|> | 
|  | 77     Exec["buildslave#$title"] <- File <|path == $basedir|> | 
|  | 78 | 
|  | 79     file {"$basedir/info/admin": | 
|  | 80       content => $admin, | 
|  | 81       owner => $user, | 
|  | 82       require => Exec["buildslave#$title"], | 
|  | 83     } | 
|  | 84   } | 
|  | 85 | 
|  | 86   if $system != false { | 
|  | 87     ensure_packages($::buildbot::slave_packages) | 
|  | 88     realize(Concat['buildslave']) | 
|  | 89     realize(Concat::Fragment['buildslave']) | 
|  | 90     realize(Service['buildslave']) | 
|  | 91 | 
|  | 92     concat::fragment {"buildslave#$title": | 
|  | 93       content => template('buildbot/buildslave_fragment.erb'), | 
|  | 94       ensure => $ensure ? {'present' => $ensure, default => 'absent'}, | 
|  | 95       notify => Service['buildslave'], | 
|  | 96       order => 1, | 
|  | 97       target => 'buildslave', | 
|  | 98     } | 
|  | 99 | 
|  | 100     Service['buildslave'] <~ Exec <|creates == "$basedir"|> | 
|  | 101     Service['buildslave'] <~ Exec <|creates == "$basedir/buildbot.tac"|> | 
|  | 102 | 
|  | 103     Service['buildslave'] <~ File <|path == "$basedir"|> | 
|  | 104     Service['buildslave'] <~ File <|path == "$basedir/info/admin"|> | 
|  | 105   } | 
|  | 106 | 
|  | 107   if $ensure == 'purged' { | 
|  | 108     file {$basedir: ensure => 'absent'} | 
|  | 109   } | 
|  | 110 } | 
| OLD | NEW | 
|---|