← Back to team overview

yellow team mailing list archive

[Merge] lp:~gmb/charms/oneiric/buildbot-master/2012-02-07 into lp:~yellow/charms/oneiric/buildbot-master/trunk

 

Graham Binns has proposed merging lp:~gmb/charms/oneiric/buildbot-master/2012-02-07 into lp:~yellow/charms/oneiric/buildbot-master/trunk.

Requested reviews:
  Launchpad Yellow Squad (yellow)

For more details, see:
https://code.launchpad.net/~gmb/charms/oneiric/buildbot-master/2012-02-07/+merge/91888

Changes from gmb and frankban for 2012-02-07
============================================

 - slave_info.json is now only updated if there are builders; this allows us to work around the fact that buildbot-relation-changed is called twice, once without builders, once with.
 - hooks/config-changed now handles extra-packages properly.
 - hooks/config-changed now initialises slave_info.json if it doesn't exist.
 - Removed some cruft from hooks/install.
-- 
https://code.launchpad.net/~gmb/charms/oneiric/buildbot-master/2012-02-07/+merge/91888
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~gmb/charms/oneiric/buildbot-master/2012-02-07 into lp:~yellow/charms/oneiric/buildbot-master/trunk.
=== modified file 'hooks/buildbot-relation-changed'
--- hooks/buildbot-relation-changed	2012-02-07 13:29:08 +0000
+++ hooks/buildbot-relation-changed	2012-02-07 17:36:18 +0000
@@ -39,9 +39,10 @@
     log("builders: {}".format(builders))
     name = get_or_create('name', prefix='slave-')
     passwd = get_or_create('passwd')
-    update_slave_json(builders, name, passwd)
-    log("Reconfiguring buildbot.")
-    buildbot_reconfig()
+    if builders:
+        update_slave_json(builders, name, passwd)
+        log("Reconfiguring buildbot.")
+        buildbot_reconfig()
     log("Sending name and password to the slave.")
     relation_set(name=name, passwd=passwd)
 

=== modified file 'hooks/config-changed'
--- hooks/config-changed	2012-02-07 13:29:08 +0000
+++ hooks/config-changed	2012-02-07 17:36:18 +0000
@@ -25,6 +25,7 @@
     buildbot_reconfig,
     config_json,
     generate_string,
+    slave_json,
     )
 
 REQUIRED_KEYS = [
@@ -67,7 +68,7 @@
     if extra_repo and 'extra-repository' in added_or_changed:
         install_extra_repository(extra_repo)
         restart_required = True
-    if extra_pkgs and 'extra_packages' in added_or_changed:
+    if extra_pkgs and 'extra-packages' in added_or_changed:
         apt_get_install(
             *(pkg.strip() for pkg in extra_pkgs.split()))
         restart_required = True
@@ -128,6 +129,9 @@
     shutil.move(master_cfg_path, master_cfg_path + '.original')
     shutil.copy(
         os.path.join(os.path.dirname(__file__), 'master.cfg'), master_cfg_path)
+    # Initialise the slave JSON if it doesn't exist.
+    if not slave_json.exists():
+        slave_json.set({})
     placeholder_path = os.path.join(buildbot_dir, 'placeholder.json')
     if not os.path.exists(placeholder_path):
         with open(placeholder_path, 'w') as f:

=== modified file 'hooks/install'
--- hooks/install	2012-02-07 13:29:08 +0000
+++ hooks/install	2012-02-07 17:36:18 +0000
@@ -15,7 +15,6 @@
     )
 from local import (
     config_json,
-    slave_json,
     )
 
 
@@ -35,7 +34,6 @@
     # Initialize the cached config so that old configs don't hang around
     # after the service is torn down.
     config_json.set({})
-    slave_json.set({})
 
 
 def main():


Follow ups