From 69d465b3c96cf88ba53d8a89ab0c3633f36df93b Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 17 Jul 2008 21:32:44 +0000 Subject: [PATCH] support slice access here --- qaapi/qa/Nodes.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/qaapi/qa/Nodes.py b/qaapi/qa/Nodes.py index ee0cf3a..3c19a35 100644 --- a/qaapi/qa/Nodes.py +++ b/qaapi/qa/Nodes.py @@ -26,7 +26,8 @@ class Node(dict, VRemote): 'tests_dir': '/usr/share/tests/', 'tests': [] # which test to run. None or empty list means run all } - + + def __init__(self, config, fields = {}): # XX Filter out fields not specified in fields @@ -116,6 +117,7 @@ class Node(dict, VRemote): # Check results. We are ready if all passed if not set(results.values()).intersection([False, None]): + utils.header("%s is ready" % (self['hostname'])) ready = True else: if self.config.verbose: @@ -127,19 +129,42 @@ class Node(dict, VRemote): def download_testscripts(self): node_tests_dir = self['tests_dir'] + self.commands("mkdir %(node_tests_dir)s" % locals(), fatal = False) (archive_filename, archive_path) = self.config.archive_node_tests() self.scp_to(archive_path, node_tests_dir) # Extract tests archive - tarx_cmd = "cd %(tests_dir)s && tar -xzm -f %(archive_filename)s" % locals() + tarx_cmd = "cd %(node_tests_dir)s && tar -xzm -f %(archive_filename)s" % locals() print >> self.logfile, tarx_cmd self.popen(tarx_cmd) # Make tests executable # XX Should find a better way to do this - chmod_cmd = "cd %s/node && chmod -R 755 * " % (tests_dir ) + chmod_cmd = "cd %s/node && chmod -R 755 * " % (node_tests_dir) print >> self.logfile, chmod_cmd self.popen(chmod_cmd) + + def slice_commands(self, command, slice, key = None): + if key is None: + print self.config.slices + # get a valid key + persons = self.config.slices[slice]['persons'] + if not persons: raise Exception + name, domain = persons[0].split('@') + key = "/%s/%s" % (self.config.KEYS_PATH, name) + + return VRemote.slice_commands(command, slice, key, False) + + def get_logs(self, files = None): + + hostname = self['hostname'] + logs_dir = '/var/log/' + dest = "%s/%s-var.log/" % (self.logfile.dir, hostname) + try: os.mkdir(dest) + except: pass + #utils.commands('rm -Rf %(dest)s/*' % locals()) + self.scp_from(logs_dir, dest, recursive = True) + class Nodes(Table): -- 2.43.0