Skip to content

Instantly share code, notes, and snippets.

@rail
Created March 19, 2013 22:36
Show Gist options
  • Select an option

  • Save rail/5200780 to your computer and use it in GitHub Desktop.

Select an option

Save rail/5200780 to your computer and use it in GitHub Desktop.
diff --git a/modules/buildmaster/lib/facter/num_masters.rb b/modules/buildmaster/lib/facter/num_masters.rb
--- a/modules/buildmaster/lib/facter/num_masters.rb
+++ b/modules/buildmaster/lib/facter/num_masters.rb
@@ -1,10 +1,9 @@
# num_masters.rb
#
require 'facter'
-if FileTest.exists?("/etc/default/buildbot.d")
- Facter.add("num_masters") do
- setcode do
- Facter::Util::Resolution.exec('ls -1 /etc/default/buildbot.d | wc -l')
- end
+
+Facter.add("num_masters") do
+ setcode do
+ Facter::Util::Resolution.exec('(ls -1 /etc/default/buildbot.d 2>/dev/null | wc -l ) || :')
end
end
diff --git a/modules/buildmaster/manifests/buildbot_master.pp b/modules/buildmaster/manifests/buildbot_master.pp
--- a/modules/buildmaster/manifests/buildbot_master.pp
+++ b/modules/buildmaster/manifests/buildbot_master.pp
@@ -62,7 +62,8 @@ define buildmaster::buildbot_master($bas
content => template("buildmaster/postrun.cfg.erb");
"/etc/default/buildbot.d/${master_name}":
content => "${full_master_dir}",
- require => Exec["setup-${basedir}"];
+ require => Exec["setup-${basedir}"],
+ before => Nrpe::Custom["buildbot.cfg"];
"/etc/cron.d/${master_name}":
require => Exec["setup-${basedir}"],
mode => 600,
@@ -81,17 +82,15 @@ define buildmaster::buildbot_master($bas
Buildmaster::Repos["clone-buildbot-${master_name}"],
File["${full_master_dir}"],
],
- command => "/usr/bin/make -f Makefile.setup all BASEDIR=${full_master_dir} MASTER_NAME=${master_name}",
+ command => "/usr/bin/make -f Makefile.setup all BASEDIR=${full_master_dir} MASTER_NAME=${master_name} \
+ VIRTUALENV=${::packages::mozilla::py27_virtualenv::virtualenv} \
+ PYTHON=${::packages::mozilla::python27::python} \
+ HG=${::packages::mozilla::py27_mercurial::mercurial}
+ MASTERS_JSON=${buildmaster::settings::master_json}",
creates => "${full_master_dir}/bin/buildbot",
user => $master_user,
group => $master_group,
logoutput => on_failure,
- environment => [
- "VIRTUALENV=${::packages::mozilla::py27_virtualenv::virtualenv}",
- "PYTHON=${::packages::mozilla::python27::python}",
- "HG=${::packages::mozilla::py27_mercurial::mercurial}",
- "MASTERS_JSON=${buildmaster::settings::master_json}",
- ],
cwd => "${buildbot_configs_dir}";
}
}
diff --git a/modules/buildmaster/templates/buildbot.cfg.erb b/modules/buildmaster/templates/buildbot.cfg.erb
--- a/modules/buildmaster/templates/buildbot.cfg.erb
+++ b/modules/buildmaster/templates/buildbot.cfg.erb
@@ -2,4 +2,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-command[check_buildbot]=<%= scope.lookupvar('nrpe::base::plugins_dir') %>/check_procs -c <%= num_masters %>:<%= num_masters %> -C buildbot
+command[check_buildbot]=<%= scope.lookupvar('nrpe::base::plugins_dir') %>/check_procs -c <%= scope.lookupvar('::num_masters') %>:<%= scope.lookupvar('::num_masters') %> -C buildbot
diff --git a/modules/dirs/manifests/builds/buildbot.pp b/modules/dirs/manifests/builds/buildbot.pp
--- a/modules/dirs/manifests/builds/buildbot.pp
+++ b/modules/dirs/manifests/builds/buildbot.pp
@@ -2,6 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
class dirs::builds::buildbot {
+ include dirs::builds
include users::builder
include config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment