Skip to content
Snippets Groups Projects
Commit 3cf22e8e authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

add boolean that prevents a workflow from getting aborted to pp interaction steps

parent 5a52846f
No related branches found
No related tags found
1 merge request!64new IP trunk migration
...@@ -295,7 +295,7 @@ def _confirm_pp_results(state: State) -> FormGenerator: ...@@ -295,7 +295,7 @@ def _confirm_pp_results(state: State) -> FormGenerator:
return {"pp_did_succeed": successful_run} 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. """Interaction with the provisioning proxy.
This method returns the three steps that make up an 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: ...@@ -308,12 +308,14 @@ def pp_interaction(provisioning_step: Step, attempts: int) -> StepList:
in a later release. in a later release.
The parameter `attempts` indicates how many times a provisioning may be attempted. When this amount is exceeded, and 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. :param provisioning_step: The step that executes an interaction with the provisioning proxy.
:type provisioning_step: {class}`orchestrator.workflow.Step` :type provisioning_step: {class}`orchestrator.workflow.Step`
:param attempts: The maximum amount of times that a provisioning can be retried. :param attempts: The maximum amount of times that a provisioning can be retried.
:type attempts: int :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. :return: A list of three steps that form one interaction with the provisioning proxy.
:rtype: {class}`orchestrator.workflow.StepList` :rtype: {class}`orchestrator.workflow.StepList`
""" """
...@@ -328,7 +330,8 @@ def pp_interaction(provisioning_step: Step, attempts: int) -> StepList: ...@@ -328,7 +330,8 @@ def pp_interaction(provisioning_step: Step, attempts: int) -> StepList:
>> should_retry_pp_steps(_confirm_pp_results) >> should_retry_pp_steps(_confirm_pp_results)
) )
# Abort a workflow if provisioning has failed too many times if abort_on_failure:
pp_steps >>= should_retry_pp_steps(abort) # Abort a workflow if provisioning has failed too many times
pp_steps >>= should_retry_pp_steps(abort)
return pp_steps return pp_steps
...@@ -241,10 +241,10 @@ def create_iptrunk() -> StepList: ...@@ -241,10 +241,10 @@ def create_iptrunk() -> StepList:
>> get_info_from_ipam >> get_info_from_ipam
>> pp_interaction(provision_ip_trunk_iface_dry, 3) >> pp_interaction(provision_ip_trunk_iface_dry, 3)
>> pp_interaction(provision_ip_trunk_iface_real, 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_dry, 3)
>> pp_interaction(provision_ip_trunk_isis_iface_real, 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) >> set_status(SubscriptionLifecycle.ACTIVE)
>> resync >> resync
>> done >> done
......
...@@ -397,9 +397,9 @@ def migrate_iptrunk() -> StepList: ...@@ -397,9 +397,9 @@ def migrate_iptrunk() -> StepList:
>> pp_interaction(deploy_new_config_dry, 3) >> pp_interaction(deploy_new_config_dry, 3)
>> pp_interaction(deploy_new_config_real, 3) >> pp_interaction(deploy_new_config_real, 3)
>> confirm_continue >> confirm_continue
>> pp_interaction(run_interface_checks, 3) >> pp_interaction(run_interface_checks, 3, False)
>> pp_interaction(deploy_new_isis, 3) >> pp_interaction(deploy_new_isis, 3)
>> pp_interaction(check_isis, 3) >> pp_interaction(check_isis, 3, False)
>> confirm_continue >> confirm_continue
>> restore_isis_metric >> restore_isis_metric
>> pp_interaction(delete_old_config_dry, 3) >> pp_interaction(delete_old_config_dry, 3)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment