Only instantiate job.bootloader to a usable value
if it's really needed (ie, we want to reboot the
machine), since now we depend on a C tool to do
that and the compilation of this tool might fail.

So only throw errors if something wrong happens
there, so we don't have to punish users that only
want to run some tests with the autotest client.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/bin/job.py |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/client/bin/job.py b/client/bin/job.py
index 9d9ec9b..317c169 100644
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -242,7 +242,7 @@ class base_client_job(base_job.base_job):
         self._config = config.config(self)
         self.profilers = profilers.profilers(self)
 
-        self._init_bootloader()
+        self.bootloader = None
 
         self.machines = [options.hostname]
         self.hosts = set([local_host.LocalHost(hostname=options.hostname,
@@ -294,7 +294,11 @@ class base_client_job(base_job.base_job):
         Perform boottool initialization.
         """
         tool = self.config_get('boottool.executable')
-        self.bootloader = boottool.boottool(tool)
+        try:
+            self.bootloader = boottool.boottool(tool)
+        except Exception, err:
+            logging.error(err)
+            self.bootloader = None
 
 
     def _init_packages(self):
@@ -891,6 +895,9 @@ class base_client_job(base_job.base_job):
         self.reboot_setup()
         self.harness.run_reboot()
         default = self.config_get('boot.set_default')
+        self._init_bootloader()
+        if self.bootloader is None:
+            raise error.JobError("Unable to instantiate bootloader")
         if default:
             self.bootloader.set_default(tag)
         else:
-- 
1.7.9.3

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to