summaryrefslogtreecommitdiff
path: root/morphlib/buildcommand.py
diff options
context:
space:
mode:
authorLauren Perry <lauren.perry@codethink.co.uk>2015-04-02 17:23:07 +0100
committerRichard Ipsum <richardipsum@fastmail.co.uk>2015-04-29 16:10:58 +0000
commit84096556ea54d4af236f1fe5f7ccf61c1343016f (patch)
tree76b5aa72bf9c691fd8e154feade051c2ceba16ac /morphlib/buildcommand.py
parent4a1c2d118511da067fcadf2253fdc2a49d04e4fa (diff)
downloadmorph-84096556ea54d4af236f1fe5f7ccf61c1343016f.tar.gz
distbuild: Add distbuild start and cancel functionality
Add command for distbuild-start to build_plugin in morphlib, and create a boolean parameter to inform the initiator whether to disconnect the controller and leave the build running remotely. Add distbuild-cancel command to parse currently-running distbuild build-request IDs and cancel the one matching the given argument Change-Id: I458a5767bb768ceb2b4d8876adf1c86075d452bd
Diffstat (limited to 'morphlib/buildcommand.py')
-rw-r--r--morphlib/buildcommand.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py
index 37dccf82..efd10f26 100644
--- a/morphlib/buildcommand.py
+++ b/morphlib/buildcommand.py
@@ -525,10 +525,11 @@ class InitiatorBuildCommand(BuildCommand):
RECONNECT_INTERVAL = 30 # seconds
MAX_RETRIES = 1
- def __init__(self, app, addr, port):
+ def __init__(self, app, addr, port, allow_detach):
self.app = app
self.addr = addr
self.port = port
+ self.allow_detach = allow_detach
self.app.settings['push-build-branches'] = True
super(InitiatorBuildCommand, self).__init__(app)
@@ -546,10 +547,15 @@ class InitiatorBuildCommand(BuildCommand):
loop = distbuild.MainLoop()
args = [repo_name, ref, filename, original_ref or ref,
component_names]
+ if self.allow_detach:
+ initiator_type = distbuild.InitiatorStart
+ else:
+ initiator_type = distbuild.Initiator
+
cm = distbuild.InitiatorConnectionMachine(self.app,
self.addr,
self.port,
- distbuild.Initiator,
+ initiator_type,
[self.app] + args,
self.RECONNECT_INTERVAL,
self.MAX_RETRIES)