Index: scheduler/drones.py |
diff --git a/scheduler/drones.py b/scheduler/drones.py |
index 85a5ee297e4c95ad1df05b41a2dea924a7eb6d85..b742b55bcd8917b9cf1481636aa37f51331f135d 100644 |
--- a/scheduler/drones.py |
+++ b/scheduler/drones.py |
@@ -7,6 +7,11 @@ from autotest_lib.client.common_lib import error, global_config |
AUTOTEST_INSTALL_DIR = global_config.global_config.get_config_value('SCHEDULER', |
'drone_installation_directory') |
+class DroneUnreachable(Exception): |
+ """The drone is non-sshable.""" |
+ pass |
+ |
+ |
class _AbstractDrone(object): |
""" |
Attributes: |
@@ -111,6 +116,9 @@ class _RemoteDrone(_AbstractDrone): |
super(_RemoteDrone, self).__init__() |
self.hostname = hostname |
self._host = drone_utility.create_host(hostname) |
+ if not self._host.is_up(): |
+ logging.error('Drone %s is unpingable, kicking out', hostname) |
+ raise DroneUnreachable |
self._autotest_install_dir = AUTOTEST_INSTALL_DIR |
@@ -156,4 +164,7 @@ def get_drone(hostname): |
""" |
if hostname == 'localhost': |
return _LocalDrone() |
- return _RemoteDrone(hostname) |
+ try: |
+ return _RemoteDrone(hostname) |
+ except DroneUnreachable: |
+ return None |