diff --git a/gso/services/provisioning_proxy.py b/gso/services/provisioning_proxy.py index 4c90ea7b894fb8b58c0d08604e8197aa2d6b770b..af0902a156220f13a35b5aed3b87984ee773fc16 100644 --- a/gso/services/provisioning_proxy.py +++ b/gso/services/provisioning_proxy.py @@ -295,7 +295,7 @@ def _confirm_pp_results(state: State) -> FormGenerator: return {"pp_did_succeed": successful_run} -def pp_interaction(provisioning_step: Step, attempts: int) -> StepList: +def pp_interaction(provisioning_step: Step, attempts: int, abort_on_failure: bool = True) -> StepList: """Interaction with the provisioning proxy. This method returns the three steps that make up an interaction with the provisioning proxy: @@ -308,12 +308,14 @@ def pp_interaction(provisioning_step: Step, attempts: int) -> StepList: in a later release. The parameter `attempts` indicates how many times a provisioning may be attempted. When this amount is exceeded, and - it's still not successful, the workflow will be aborted. + it's still not successful, the workflow will be aborted if so indicated with the `abort_on_failure` boolean. :param provisioning_step: The step that executes an interaction with the provisioning proxy. :type provisioning_step: {class}`orchestrator.workflow.Step` :param attempts: The maximum amount of times that a provisioning can be retried. :type attempts: int + :param abort_on_failure: A boolean value that indicates whether a workflow should abort if the provisioning has + failed the maximum amount of tries. Defaults to `True`. :return: A list of three steps that form one interaction with the provisioning proxy. :rtype: {class}`orchestrator.workflow.StepList` """ @@ -328,7 +330,8 @@ def pp_interaction(provisioning_step: Step, attempts: int) -> StepList: >> should_retry_pp_steps(_confirm_pp_results) ) - # Abort a workflow if provisioning has failed too many times - pp_steps >>= should_retry_pp_steps(abort) + if abort_on_failure: + # Abort a workflow if provisioning has failed too many times + pp_steps >>= should_retry_pp_steps(abort) return pp_steps diff --git a/gso/workflows/iptrunk/create_iptrunk.py b/gso/workflows/iptrunk/create_iptrunk.py index 0bc9d4aedf5e4b36dabf0faf132b22cb75a0bb6a..16b4a2913136832162a499cb2a64605ee1f3ca77 100644 --- a/gso/workflows/iptrunk/create_iptrunk.py +++ b/gso/workflows/iptrunk/create_iptrunk.py @@ -241,10 +241,10 @@ def create_iptrunk() -> StepList: >> get_info_from_ipam >> pp_interaction(provision_ip_trunk_iface_dry, 3) >> pp_interaction(provision_ip_trunk_iface_real, 3) - >> pp_interaction(check_ip_trunk_connectivity, 2) + >> pp_interaction(check_ip_trunk_connectivity, 2, False) >> pp_interaction(provision_ip_trunk_isis_iface_dry, 3) >> pp_interaction(provision_ip_trunk_isis_iface_real, 3) - >> pp_interaction(check_ip_trunk_isis, 2) + >> pp_interaction(check_ip_trunk_isis, 2, False) >> set_status(SubscriptionLifecycle.ACTIVE) >> resync >> done diff --git a/gso/workflows/iptrunk/migrate_iptrunk.py b/gso/workflows/iptrunk/migrate_iptrunk.py index 7161f08385356ab551e930b993024641d7d0f1de..e6acfb36f2921b7eda7e5aacb5768285cae795be 100644 --- a/gso/workflows/iptrunk/migrate_iptrunk.py +++ b/gso/workflows/iptrunk/migrate_iptrunk.py @@ -397,9 +397,9 @@ def migrate_iptrunk() -> StepList: >> pp_interaction(deploy_new_config_dry, 3) >> pp_interaction(deploy_new_config_real, 3) >> confirm_continue - >> pp_interaction(run_interface_checks, 3) + >> pp_interaction(run_interface_checks, 3, False) >> pp_interaction(deploy_new_isis, 3) - >> pp_interaction(check_isis, 3) + >> pp_interaction(check_isis, 3, False) >> confirm_continue >> restore_isis_metric >> pp_interaction(delete_old_config_dry, 3)