← Back to team overview

yellow team mailing list archive

[Merge] lp:~frankban/charms/oneiric/buildbot-master/02-14 into lp:~yellow/charms/oneiric/buildbot-master/trunk

 

Francesco Banconi has proposed merging lp:~frankban/charms/oneiric/buildbot-master/02-14 into lp:~yellow/charms/oneiric/buildbot-master/trunk.

Requested reviews:
  Launchpad Yellow Squad (yellow)

For more details, see:
https://code.launchpad.net/~frankban/charms/oneiric/buildbot-master/02-14/+merge/92955

The slaves JSON file can not be initialized in the install hook, because the buildbot user does not exist at that time.
In this new revision the file is removed (if it exists) in the install hook, and correctly initialized in config-changed (as before).
-- 
https://code.launchpad.net/~frankban/charms/oneiric/buildbot-master/02-14/+merge/92955
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~frankban/charms/oneiric/buildbot-master/02-14 into lp:~yellow/charms/oneiric/buildbot-master/trunk.
=== modified file 'hooks/config-changed'
--- hooks/config-changed	2012-02-13 17:31:29 +0000
+++ hooks/config-changed	2012-02-14 11:50:48 +0000
@@ -146,6 +146,9 @@
     uid, gid = get_user_ids('buildbot')
     os.chown(master_cfg_path, uid, gid)
     with su('buildbot'):
+        # 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-13 17:31:29 +0000
+++ hooks/install	2012-02-14 11:50:48 +0000
@@ -14,7 +14,6 @@
     log_entry,
     log_exit,
     run,
-    su,
     )
 from local import (
     config_json,
@@ -38,9 +37,9 @@
     # Initialize the cached config so that old configs don't hang around
     # after the service is torn down.
     config_json.set({})
-    # # Initialise the slave JSON.
-    with su('buildbot'):
-        slave_json.set({})
+    # Remove the slaves JSON file if it exists.
+    if os.path.exists(slave_json.path):
+        os.remove(slave_json.path)
 
 
 def main():


Follow ups