diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-10-09 15:00:24 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-10-09 15:00:24 +0100 |
commit | 99e021d5135c90662dc470110d584cea3dc7805b (patch) | |
tree | 0c55cff666a5bed5753ee98d8822945acfabb96f /lorrycontroller | |
parent | c0a04093225730d70539147ac858257e84d2309c (diff) | |
download | lorry-controller-99e021d5135c90662dc470110d584cea3dc7805b.tar.gz |
Support HEAD setting
Diffstat (limited to 'lorrycontroller')
-rw-r--r-- | lorrycontroller/confparser.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/lorrycontroller/confparser.py b/lorrycontroller/confparser.py index 9c4e4b4..1df3186 100644 --- a/lorrycontroller/confparser.py +++ b/lorrycontroller/confparser.py @@ -190,14 +190,25 @@ class LorryControllerConfig(object): # 1. Ensure that if we need to 'ls' the trove, we do it now = time.time() listcmdargs = ["ssh", "-oStrictHostKeyChecking=no", - "-oBatchMode=yes", "git@" + trove['trovehost'], "ls"] - state['next-ls'] = state.get('next-ls', now - 1) - if state['next-ls'] < now: + "-oBatchMode=yes", "git@" + trove['trovehost'], "ls", + "--verbose"] + state['next-vls'] = state.get('next-vls', now - 1) + if state['next-vls'] < now: exit, out, err = self.app.maybe_runcmd(listcmdargs) if exit == 0: - state['last-ls-output'] = [x[3:] for x in out.split("\n")] - while state['next-ls'] < now: - state['next-ls'] += trove['ls-interval-parsed'] + repo_info = {} + for entry in [x for x in out.split("\n") if x != ""]: + elems = entry.split(" ") + this_repo = { + "perm": elems[0], + "name": elems[1], + "head": elems[2], + "desc": " ".join(elems[3:]), + } + repo_info[elems[1]] = this_repo + state['last-ls-output'] = repo_info + while state['next-vls'] < now: + state['next-vls'] += trove['ls-interval-parsed'] else: # Pass through unchanged state['last-ls-output'] = state.get('last-ls-output', []) @@ -210,7 +221,7 @@ class LorryControllerConfig(object): # 2. For every entry in last-ls-output, construct a lorry if we want it lorries_made = set() - for remotereponame in state['last-ls-output']: + for remotereponame, info in state['last-ls-output'].iteritems(): localreponame = None for local, remote in trove['prefixmap'].iteritems(): if remotereponame.startswith(remote+"/"): @@ -222,7 +233,8 @@ class LorryControllerConfig(object): "type": "git", "url": "ssh://git@%s/%s.git" % (trove['trovehost'], remotereponame), - "controller-uuid": trove['uuid'] + "controller-uuid": trove['uuid'], + "source-HEAD": info["head"], } if localreponame in self.lorries: logging.warn("Skipping %s (%s from %s) because we already " |