Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 666762: DisconnectStep should disconnect harder! r=dustin

  • Loading branch information...
commit 79de871ebe358e7a459aff1e5490263ae42a29fb 1 parent 36da128
@catlee catlee authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 steps/misc.py
View
19 steps/misc.py
@@ -728,6 +728,7 @@ def __init__(self, force_disconnect=None, **kwargs):
self.addFactoryArguments(force_disconnect=force_disconnect)
self._disconnected = False
+ self._deferred_death = None
def interrupt(self, reason):
# Called when the slave command is interrupted, e.g. by rebooting
@@ -735,6 +736,15 @@ def interrupt(self, reason):
self._disconnected = True
return self.finished(SUCCESS)
+ def start(self):
+ # Give the machine 60 seconds to go away on its own
+ def die():
+ self._deferred_death = None
+ log.msg("Forcibly disconnecting %s" % self.getSlaveName())
+ self.buildslave.disconnect()
+ self._deferred_death = reactor.callLater(60, die)
+ return self.super_class.start(self)
+
def checkDisconnect(self, f):
# This is called if there's a problem executing the command because the connection was disconnected.
# Again, we assume this is the expected behaviour
@@ -754,6 +764,12 @@ def commandComplete(self, cmd):
return d
except:
log.err()
+ return
+
+ # Otherwise, cancel our execution
+ if self._deferred_death and self._deferred_death.active:
+ self._deferred_death.cancel()
+ self._deferred_death = None
def _disconnected_cb(self, res):
# Successfully disconnected
@@ -764,6 +780,9 @@ def finished(self, res):
if self._disconnected:
self.step_status.setText(self.describe(True) + ["slave", "lost"])
self.step_status.setText2(['slave', 'lost'])
+ if self._deferred_death and self._deferred_death.active:
+ self._deferred_death.cancel()
+ self._deferred_death = None
return self.super_class.finished(self, res)
class RepackPartners(ShellCommand):
Please sign in to comment.
Something went wrong with that request. Please try again.