[autotest] Refactor reimage type selection to support >2 types.
One now passes a string that is tied to the name of the type of
reimaging that one would like to do. More reimaging types can now
be easily added.
BUG=chromium-os:38250
TEST=run_suite with trybot'd control.dummy changed to use reimage_type
Change-Id: I276556ff6822800cc846b20b564ffc36ec07e61b
Reviewed-on: https://gerrit.chromium.org/gerrit/42748
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Alex Miller <milleral@chromium.org>
Tested-by: Alex Miller <milleral@chromium.org>
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index d52eb14..d9854db 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -2,7 +2,7 @@
Internal global error types
"""
-import sys, traceback, threading, logging
+import sys, traceback, threading
from traceback import format_exception
# Add names you want to be imported by 'from errors import *' to this list.
@@ -109,7 +109,7 @@
def exception_context(e):
"""Return the context of a given exception (or None if none is defined)."""
if hasattr(e, "_context"):
- return e._context
+ return e._context # pylint: disable=W0212
def set_exception_context(e, s):
@@ -198,29 +198,29 @@
class TestBaseException(AutotestError):
"""The parent of all test exceptions."""
# Children are required to override this. Never instantiate directly.
- exit_status="NEVER_RAISE_THIS"
+ exit_status = "NEVER_RAISE_THIS"
class TestError(TestBaseException):
"""Indicates that something went wrong with the test harness itself."""
- exit_status="ERROR"
+ exit_status = "ERROR"
class TestNAError(TestBaseException):
"""Indictates that the test is Not Applicable. Should be thrown
when various conditions are such that the test is inappropriate."""
- exit_status="TEST_NA"
+ exit_status = "TEST_NA"
class TestFail(TestBaseException):
"""Indicates that the test failed, but the job will not continue."""
- exit_status="FAIL"
+ exit_status = "FAIL"
class TestWarn(TestBaseException):
"""Indicates that bad things (may) have happened, but not an explicit
failure."""
- exit_status="WARN"
+ exit_status = "WARN"
class UnhandledTestError(TestError):
@@ -560,6 +560,11 @@
pass
+class UnknownReimageType(CrosDynamicSuiteException):
+ """Raised when a suite passes in an invalid reimage type"""
+ pass
+
+
class LabIsDownException(Exception):
"""Raised when the Lab is Down"""
pass