summaryrefslogtreecommitdiff
path: root/lorry-controller
diff options
context:
space:
mode:
Diffstat (limited to 'lorry-controller')
-rwxr-xr-xlorry-controller13
1 files changed, 12 insertions, 1 deletions
diff --git a/lorry-controller b/lorry-controller
index ba793ad..cf5dbae 100755
--- a/lorry-controller
+++ b/lorry-controller
@@ -124,6 +124,8 @@ class LorryController(cliapp.Application):
logging.error(err)
store_state = False
if store_state:
+ self.maybe_runcmd(["ssh", "git@localhost", "set-head",
+ new_lorry, lorry['source-HEAD']])
mgr.lorry_state[new_lorry] = {
'destroy': conf['destroy'],
'conf': conf_uuid,
@@ -142,7 +144,13 @@ class LorryController(cliapp.Application):
if mgr.lorry_state[upd_lorry]['lorry'] != \
self.conf.lorries[upd_lorry]:
lorry = self.conf.lorries[upd_lorry]
+ old_lorry = mgr.lorry_state[upd_lorry]["lorry"]
+ if lorry["source-HEAD"] != \
+ old_lorry.get("source-HEAD", "refs/heads/master"):
+ self.maybe_runcmd(['ssh', 'git@localhost', 'set-head',
+ upd_lorry, lorry["source-HEAD"]])
conf_uuid = lorry['controller-uuid']
+ conf = self.conf.configs[conf_uuid]
nextdue = self.conf.duetimes[upd_lorry]
mgr.lorry_state[upd_lorry] = {
'destroy': conf['destroy'],
@@ -201,7 +209,10 @@ class LorryController(cliapp.Application):
'git'))
def maybe_runcmd(self, *args, **kwargs):
- if not self.settings['dry-run']:
+ cmdargs = args[0]
+ if (not self.settings['dry-run']) or \
+ (cmdargs[0] == "ssh" and \
+ cmdargs[len(cmdargs)-1] == "--verbose"):
return self.runcmd_unchecked(*args, **kwargs)
else:
logging.debug("DRY-RUN: Not running %r" % args)