Added specific exceptions for various failures in verify and changed the
code that raised them to use these new exceptions. Completely reworked
the 3 repair phases to try to fix things by handling the specific errors
generated by verify (in a loop where it exits either by not being able
to fix an issue or if the last verify ran successfully). Reorganized
some code to support this new way to repair hosts.
The code tries to remember each repair handler it used to catch the case
where even after executing the handler the same verify failure is
reported and it may execute the repair handler in an infinite loop.
When it finds out that the same repair handler has already been executed
it will re-raise the original exception hoping it will be cought in
surrounding try/except contexts or the exception will make repair fail.
Signed-off-by: Mihai Rusu <[email protected]>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3217 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/abstract_ssh.py b/server/hosts/abstract_ssh.py
index 9c41c9a..fe585ff 100644
--- a/server/hosts/abstract_ssh.py
+++ b/server/hosts/abstract_ssh.py
@@ -297,8 +297,10 @@
#let AutoservSshPermissionDeniedError be visible to the callers
raise
except error.AutoservRunError, e:
- msg = "command true failed in ssh ping"
- raise error.AutoservRunError(msg, e.result_obj)
+ # convert the generic AutoservRunError into something more
+ # specific for this context
+ raise error.AutoservSshPingHostError(e.description + '\n' +
+ repr(e.result_obj))
def is_up(self):
@@ -398,7 +400,7 @@
self.ssh_ping()
if self.is_shutting_down():
- raise error.AutoservHostError("Host is shutting down")
+ raise error.AutoservHostIsShuttingDownError("Host is shutting down")
super(AbstractSSHHost, self).verify_software()