Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/buildbot/manifests/slave.pp

Issue 29325436: Issue 1281 - Introduce module buildbot (Closed)
Patch Set: Issue 1281 - Address review feedback Created Oct. 20, 2015, 8:35 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/buildbot/manifests/slave.pp
diff --git a/modules/buildbot/manifests/slave.pp b/modules/buildbot/manifests/slave.pp
new file mode 100644
index 0000000000000000000000000000000000000000..17b7069221be45f929b1cfa60c15d278f707307c
--- /dev/null
+++ b/modules/buildbot/manifests/slave.pp
@@ -0,0 +1,110 @@
+# == Type: buildbot::slave
+#
+# Manage Buildbot (http://buildbot.net/) slave instances.
+#
+# === Parameters:
+#
+# [*basedir*]
+# The base directory of the slave, which can be configured elsewhere or,
+# if it's ancestors are present, relied upon the builtin defaults.
Felix Dahlke 2015/11/19 19:50:01 Typo: "its"
mathias 2016/01/20 16:13:52 Acknowledged.
+#
+# [*ensure*]
+# Whether to setup the slave (anything but 'absent' or 'purged') or
Felix Dahlke 2015/11/19 19:50:02 Typo: "set up"
mathias 2016/01/20 16:13:52 Acknowledged.
+# remove the associated resources. Note that only 'purged' implies the
+# removal of $basedir.
+#
+# [*master*]
+# The "$hostname:$port" combination of the build master.
+#
+# [*name*]
+# The build slave's name.
+#
+# [*password*]
+# The build slave's password with the master.
+#
+# [*system*]
+# Any value beside 'false' will cause the slave operations to also
+# affect the buildbot::buildslave service. Use this option to include
+# the slave instance with the system daemon.
+#
+# [*user*]
+# The user to whom the slave instance belongs to. Note that the user
+# is not created implicitly by this setup, except if the creation is
+# implied with any of the $buildbot::slave_packages.
+#
+# === Examples:
+#
+# buildbot::slave {'alpha':
+# basedir => '/var/buildslave-alpha',
+# }
+#
+# buildbot::slave {'beta':
+# ensure => absent,
+# }
+#
+define buildbot::slave (
+ $admin = 'buildbot@localhost',
+ $basedir = "$::buildbot::slave_directory/$name",
+ $ensure = 'present',
+ $master = 'localhost:9989',
+ $password = 'changeme',
+ $system = false,
+ $user = $::buildbot::slave_user,
+) {
+
+ if $ensure !~ /^(absent|purged)$/ {
+ ensure_packages($::buildbot::slave_packages)
+ realize(File[$::buildbot::slave_directory])
+
+ exec {"buildslave#$title":
+ command => shellquote([
+ $::buildbot::slave_runner,
+ 'create-slave',
+ $basedir,
+ $master,
+ $name,
+ $password,
+ ]),
+ creates => "$basedir/buildbot.tac",
+ require => [
+ File[$::buildbot::master_directory],
+ Package[$::buildbot::master_packages],
+ ],
+ user => $user,
+ }
+
+ Exec["buildslave#$title"] <- Exec <|creates == $basedir|>
+ Exec["buildslave#$title"] <- File <|path == $basedir|>
+
+ file {"$basedir/info/admin":
+ content => $admin,
+ owner => $user,
+ require => Exec["buildslave#$title"],
+ }
+ }
+
+ if $system != false {
+ ensure_packages($::buildbot::slave_packages)
+ realize(Concat['buildslave'])
+ realize(Concat::Fragment['buildslave'])
+ realize(Service['buildslave'])
+
+ concat::fragment {"buildslave#$title":
+ content => template('buildbot/buildslave_fragment.erb'),
+ ensure => $ensure ? {'present' => $ensure, default => 'absent'},
+ notify => Service['buildslave'],
+ order => 1,
+ target => 'buildslave',
+ }
+
+ Service['buildslave'] <~ Exec <|creates == "$basedir"|>
+ Service['buildslave'] <~ Exec <|creates == "$basedir/buildbot.tac"|>
+
+ Service['buildslave'] <~ File <|path == "$basedir"|>
+ Service['buildslave'] <~ File <|path == "$basedir/info/admin"|>
+ }
+
+ if $ensure == 'purged' {
+ file {$basedir: ensure => 'absent'}
+ }
+}

Powered by Google App Engine
This is Rietveld