From c78c7358a8483348426a8ce09bfb507257909bff Mon Sep 17 00:00:00 2001 From: Gabriel Monnerat <gabriel@tiolive.com> Date: Tue, 5 Jun 2012 15:31:22 -0300 Subject: [PATCH] Refactor code to request installation and instanciation of external profiles passed on parameter dict --- erp5/util/testnode/SlapOSControler.py | 21 +++++++++++++++------ erp5/util/testnode/__init__.py | 4 ++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/erp5/util/testnode/SlapOSControler.py b/erp5/util/testnode/SlapOSControler.py index 3a15d049c0..cc64c5eba7 100644 --- a/erp5/util/testnode/SlapOSControler.py +++ b/erp5/util/testnode/SlapOSControler.py @@ -30,6 +30,7 @@ import subprocess import time import xml_marshaller import shutil +import glob MAX_PARTIONS = 10 MAX_SR_RETRIES = 3 @@ -61,10 +62,12 @@ class SlapOSControler(object): self.slap = slap self.slap.initializeConnection(config['master_url']) # register software profile - self.software_profile = config['custom_profile_path'] - slap.registerSupply().supply( - self.software_profile, - computer_guid=config['computer_id']) + self.software_path_list = config.get("software_list", []) + self.software_path_list.append(config['custom_profile_path']) + for path in self.software_path_list: + slap.registerSupply().supply( + path, + computer_guid=config['computer_id']) computer = slap.registerComputer(config['computer_id']) # Reset all previously generated software if needed if reset_software: @@ -129,8 +132,14 @@ class SlapOSControler(object): self.log("SlapOSControler.runComputerPartition") # cloudooo-json is required but this is a hack which should be removed config['instance_dict']['cloudooo-json'] = "{}" - self.slap.registerOpenOrder().request(self.software_profile, - partition_reference='testing partition', + # report-url, report-project and suite-url are required to seleniumrunner + # instance. This is a hack which must be removed. + config['instance_dict']['report-url'] = config.get("report-url", "") + config['instance_dict']['report-project'] = config.get("report-project", "") + config['instance_dict']['suite-url'] = config.get("suite-url", "") + for path in self.software_path_list: + self.slap.registerOpenOrder().request(path, + partition_reference='testing partition %s' % self.software_path_list.index(path), partition_parameter_kw=config['instance_dict']) # try to run for all partitions as one partition may in theory request another one diff --git a/erp5/util/testnode/__init__.py b/erp5/util/testnode/__init__.py index 94b9e3476a..98e607b065 100644 --- a/erp5/util/testnode/__init__.py +++ b/erp5/util/testnode/__init__.py @@ -123,5 +123,9 @@ def main(*args): else: instance_dict = {} CONFIG['instance_dict'] = instance_dict + if 'software_list' in config.sections(): + CONFIG['software_list'] = filter(None, + config.get("software_list", "path_list").split(",")) + testnode = TestNode(logger.info, CONFIG) testnode.run() -- 2.30.9