diff options
author | Lauren Perry <lauren.perry@codethink.co.uk> | 2015-05-11 15:20:31 +0000 |
---|---|---|
committer | Lauren Perry <lauren.perry@codethink.co.uk> | 2015-05-11 16:22:27 +0100 |
commit | cc79a6ba5bbc3a28b150b944ea57521fd3f27d03 (patch) | |
tree | 311665db4b8e1941528b9f28b4ef5cd9dcc8b6ee | |
parent | 5aa34de203939b69d9a2f4c0af0f65a751ff66f3 (diff) | |
download | morph-cc79a6ba5bbc3a28b150b944ea57521fd3f27d03.tar.gz |
distbuild: Fix protocol version checking for distbuild commands
This fixes an issue with distbuild-status and distbuild-cancel crashing
due to their appropriate Initiator classes not handling 'build-failed'
messages
Change-Id: Ia35c8e14a30e3a9bdea1e44f7726181db75dfbe5
-rw-r--r-- | distbuild/initiator.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/distbuild/initiator.py b/distbuild/initiator.py index d0185608..3b85826c 100644 --- a/distbuild/initiator.py +++ b/distbuild/initiator.py @@ -353,6 +353,7 @@ class InitiatorCancel(distbuild.StateMachine): handlers = { 'request-output': self._handle_request_output, + 'build-failed': self._handle_build_failed_message, } handler = handlers[event.msg['type']] @@ -363,6 +364,12 @@ class InitiatorCancel(distbuild.StateMachine): self.mainloop.queue_event(self._cm, distbuild.StopConnecting()) self._jm.close() + def _handle_build_failed_message(self, msg): + self._app.status(msg=str(msg['reason'])) + self.mainloop.queue_event(self, _Failed(msg)) + self.mainloop.queue_event(self._cm, distbuild.StopConnecting()) + self._jm.close() + def _terminate(self, event_source, event): self.mainloop.queue_event(self._cm, distbuild.StopConnecting()) self._jm.close() @@ -471,6 +478,7 @@ class InitiatorStatus(distbuild.StateMachine): handlers = { 'request-output': self._handle_request_output, + 'build-failed': self._handle_build_failed_message, } handler = handlers[event.msg['type']] @@ -481,6 +489,12 @@ class InitiatorStatus(distbuild.StateMachine): self.mainloop.queue_event(self._cm, distbuild.StopConnecting()) self._jm.close() + def _handle_build_failed_message(self, msg): + self._app.status(msg=str(msg['reason'])) + self.mainloop.queue_event(self, _Failed(msg)) + self.mainloop.queue_event(self._cm, distbuild.StopConnecting()) + self._jm.close() + def _terminate(self, event_source, event): self.mainloop.queue_event(self._cm, distbuild.StopConnecting()) self._jm.close() |