summaryrefslogtreecommitdiff
path: root/lorry-controller
diff options
context:
space:
mode:
Diffstat (limited to 'lorry-controller')
-rwxr-xr-xlorry-controller31
1 files changed, 16 insertions, 15 deletions
diff --git a/lorry-controller b/lorry-controller
index 89e20d8..985945f 100755
--- a/lorry-controller
+++ b/lorry-controller
@@ -82,25 +82,25 @@ class LorryController(cliapp.Application):
self.conf.update_troves(mgr)
prev_lorries = set(mgr.lorry_state.keys())
cur_lorries = set(self.conf.lorries.keys())
- logging.debug("Starting processing. Previously %d lorries "
- "were handled. We currently have %d defined." % (
+ logging.info("Starting processing. Previously %d lorries "
+ "were handled. We currently have %d defined." % (
len(prev_lorries), len(cur_lorries)))
# 1. Handle deletes for any old lorries we no longer want
- logging.debug("Delete any old lorries...")
+ logging.info("Delete any old lorries...")
for dead_lorry in prev_lorries - cur_lorries:
- logging.debug("Dead lorry: %s" % dead_lorry)
+ logging.info("Dead lorry: %s" % dead_lorry)
conf_uuid = mgr.lorry_state[dead_lorry]['conf']
should_delete = self.conf.configs[conf_uuid]['delete']
# TODO: also handle 'unchanged'
if should_delete == "always":
- logging.debug("TODO: Delete from Trove")
+ logging.warning("TODO: Delete from Trove")
del mgr.lorry_state[dead_lorry]
# 2. Handle creates for any new lorries we now want
- logging.debug("Create any new lorries...")
+ logging.info("Create any new lorries...")
for new_lorry in cur_lorries - prev_lorries:
- logging.debug("New lorry: %s" % new_lorry)
+ logging.info("New lorry: %s" % new_lorry)
lorry = self.conf.lorries[new_lorry]
conf_uuid = lorry['controller-uuid']
conf = self.conf.configs[conf_uuid]
@@ -111,7 +111,7 @@ class LorryController(cliapp.Application):
exit, out, err = self.maybe_runcmd(["ssh", "git@localhost",
"create", new_lorry])
if exit != 0:
- logging.info("Unable to create repo %s" % new_lorry)
+ logging.error("Unable to create repo %s" % new_lorry)
store_state = False
if store_state:
mgr.lorry_state[new_lorry] = {
@@ -125,7 +125,7 @@ class LorryController(cliapp.Application):
# 3. For every lorry we have, update the settings if necessary.
# and reset the next-due as appropriate.
- logging.debug("Update active lorry configurations...")
+ logging.info("Update active lorry configurations...")
updated_count = 0
for upd_lorry in cur_lorries:
if mgr.lorry_state[upd_lorry]['lorry'] != \
@@ -139,11 +139,11 @@ class LorryController(cliapp.Application):
'next-due': nextdue,
}
updated += 1
- logging.debug("Result: %d/%d lorries needed updating" % (
+ logging.info("Result: %d/%d lorries needed updating" % (
updated_count, len(cur_lorries)))
# 3. Iterate all active lorries and see if they're due
- logging.debug("Iterate active lorries looking for work...")
+ logging.info("Iterate active lorries looking for work...")
now = time.time()
lorried = 0
earliest_due = None
@@ -163,7 +163,7 @@ class LorryController(cliapp.Application):
conf = self.conf.configs[conf_uuid]
due = state['next-due']
lorried += 1
- logging.debug("Running %d/%d. Lorrying: %s" % (
+ logging.info("Running %d/%d. Lorrying: %s" % (
lorried, len(lorries_to_run),lorry))
with mgr.runner(lorry) as runner:
runner.run_lorry(*self.lorrycmd)
@@ -178,11 +178,12 @@ class LorryController(cliapp.Application):
what_early_due = lorry
if earliest_due is None:
- logging.debug("Lorried %d. No idea what's next." % lorried)
+ logging.info("Lorried %d. No idea what's next." % lorried)
else:
- logging.debug("Lorried %d. %s due in %d seconds" % (
+ logging.info("Lorried %d. %s due in %d seconds" % (
lorried, what_early_due, int(earliest_due - now)))
- logging.debug("All done.")
+ logging.info("All done.")
+
def rungit(self, args):
self.runcmd(['git']+args, cwd=os.path.join(self.settings['work-area'],
'git'))