Below is the shell for installer support. At the moment, this is
only useful for hooking into the Google installer, but the code
is generic - need to add a class for supporting one of the open
install tools elsewhere.
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@862 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/server_job.py b/server/server_job.py
index 2a06c3e..a29a6df 100755
--- a/server/server_job.py
+++ b/server/server_job.py
@@ -48,6 +48,14 @@
parallel_simple(cleanup, machines, log=False)
"""
+install="""\
+def install(machine):
+ host = hosts.SSHHost(machine, initialize=False)
+ host.machine_install()
+
+parallel_simple(cleanup, machines, log=False)
+"""
+
class server_job:
"""The actual job against which we do everything.
@@ -105,7 +113,8 @@
write_keyval(self.resultdir, job_data)
- def run(self, machines, reboot = False, namespace = {}):
+ def run(self, machines, reboot = False, install_before = False,
+ install_after = False, namespace = {}):
# use a copy so changes don't affect the original dictionary
namespace = namespace.copy()
@@ -118,6 +127,8 @@
status_log = os.path.join(self.resultdir, 'status.log')
namespace['__stderr'] = open(status_log, 'a', 0)
try:
+ if install_before and machines:
+ exec(preamble + install, namespace, namespace)
if self.client:
namespace['control'] = self.control
open('control', 'w').write(self.control)
@@ -131,6 +142,8 @@
finally:
if reboot and machines:
exec(preamble + cleanup, namespace, namespace)
+ if install_after and machines:
+ exec(preamble + install, namespace, namespace)
def run_test(self, url, *args, **dargs):