From c6fe8d9b4018f197c678f1df04977156fa1edc76 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Wed, 20 Feb 2013 10:05:33 +0100 Subject: [PATCH] make erp5.util.testnode able to resist to problems with slapos proxy --- erp5/util/testnode/SlapOSControler.py | 23 ++++++++++++++--------- erp5/util/testnode/testnode.py | 4 +++- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/erp5/util/testnode/SlapOSControler.py b/erp5/util/testnode/SlapOSControler.py index d9aa5422be..27eea04c7d 100644 --- a/erp5/util/testnode/SlapOSControler.py +++ b/erp5/util/testnode/SlapOSControler.py @@ -96,15 +96,20 @@ class SlapOSControler(object): # XXX: dirty, giving some time for proxy to being able to accept # connections time.sleep(10) - slap = slapos.slap.slap() - self.slap = slap - self.slap.initializeConnection(config['master_url']) - # register software profile - for path in self.software_path_list: - slap.registerSupply().supply( - path, - computer_guid=config['computer_id']) - computer = slap.registerComputer(config['computer_id']) + try: + slap = slapos.slap.slap() + self.slap = slap + self.slap.initializeConnection(config['master_url']) + # register software profile + for path in self.software_path_list: + slap.registerSupply().supply( + path, + computer_guid=config['computer_id']) + computer = slap.registerComputer(config['computer_id']) + except: + self.log("SlapOSControler.initializeSlapOSControler, \ + exception in registerSupply", exc_info=sys.exc_info()) + raise ValueError("Unable to initializeSlapOSControler") # Reset all previously generated software if needed if reset_software: self._resetSoftware() diff --git a/erp5/util/testnode/testnode.py b/erp5/util/testnode/testnode.py index 84f1ef41aa..4da0c846f2 100644 --- a/erp5/util/testnode/testnode.py +++ b/erp5/util/testnode/testnode.py @@ -436,6 +436,7 @@ branch = %(branch)s try: while True: try: + node_test_suite = None self.log = self.process_manager.log = self.testnode_log self.cleanUp(None) remote_test_result_needs_cleanup = False @@ -497,7 +498,8 @@ branch = %(branch)s except ValueError as e: # This could at least happens if runTestSuite is not found log("ValueError", exc_info=sys.exc_info()) - node_test_suite.retry_software_count += 1 + if node_test_suite is not None: + node_test_suite.retry_software_count += 1 except CancellationError, e: log("CancellationError", exc_info=sys.exc_info()) self.process_manager.under_cancellation = False -- 2.30.9