X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=qaapi%2Fqa%2FNodes.py;h=3c19a35c95b0ae964e8a15f32b4d959c478351be;hb=ecfd3c10755fc660c44151b3773f971517d017f9;hp=097e4979a8aab77b598547b16bac15fbc4278c61;hpb=01def58981345671e58f577c414def201d63b5fc;p=tests.git diff --git a/qaapi/qa/Nodes.py b/qaapi/qa/Nodes.py index 097e497..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: @@ -124,7 +126,46 @@ class Node(dict, VRemote): time.sleep(30) return ready - + + 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 %(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 * " % (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): def __init__(self, config, nodes):