From d6e9e503fa30e6295dc81537d3995815a651f610 Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Thu, 24 May 2018 14:03:03 +0100 Subject: [PATCH] framework/execution: Allow for retrying the intial reboot If the device is to perform an initial reboot, allow up to `max_retries` from the run configuration for the reboot to succeed and add logging to inform the user. --- wa/framework/execution.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wa/framework/execution.py b/wa/framework/execution.py index 79dd7551..959f183f 100644 --- a/wa/framework/execution.py +++ b/wa/framework/execution.py @@ -332,7 +332,19 @@ class Executor(object): output.basepath) if config_manager.run_config.reboot_policy.perform_initial_reboot: - self.target_manager.target.reboot() + self.logger.info('Performing inital reboot.') + attempts = config_manager.run_config.max_retries + while attempts: + try: + self.target_manager.target.reboot() + except TargetError as e: + if attempts: + attempts -= 1 + else: + raise e + else: + break + output.set_target_info(self.target_manager.get_target_info()) self.logger.info('Initializing execution context')