Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
b558f418
Verified
Commit
b558f418
authored
1 year ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Add cancel_subscription workflow
parent
bd7f0141
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/workflows/__init__.py
+2
-0
2 additions, 0 deletions
gso/workflows/__init__.py
gso/workflows/shared/__init__.py
+1
-0
1 addition, 0 deletions
gso/workflows/shared/__init__.py
gso/workflows/shared/cancel_subscription.py
+47
-0
47 additions, 0 deletions
gso/workflows/shared/cancel_subscription.py
with
50 additions
and
0 deletions
gso/workflows/__init__.py
+
2
−
0
View file @
b558f418
...
...
@@ -5,6 +5,7 @@ from orchestrator.workflows import LazyWorkflowInstance
WF_USABLE_MAP
.
update
(
{
"
cancel_subscription
"
:
[
"
initial
"
],
"
redeploy_base_config
"
:
[
"
provisioning
"
,
"
active
"
],
"
update_ibgp_mesh
"
:
[
"
provisioning
"
,
"
active
"
],
"
activate_router
"
:
[
"
provisioning
"
],
...
...
@@ -26,6 +27,7 @@ LazyWorkflowInstance("gso.workflows.router.create_router", "create_router")
LazyWorkflowInstance
(
"
gso.workflows.router.redeploy_base_config
"
,
"
redeploy_base_config
"
)
LazyWorkflowInstance
(
"
gso.workflows.router.terminate_router
"
,
"
terminate_router
"
)
LazyWorkflowInstance
(
"
gso.workflows.router.update_ibgp_mesh
"
,
"
update_ibgp_mesh
"
)
LazyWorkflowInstance
(
"
gso.workflows.shared.cancel_subscription
"
,
"
cancel_subscription
"
)
LazyWorkflowInstance
(
"
gso.workflows.site.create_site
"
,
"
create_site
"
)
LazyWorkflowInstance
(
"
gso.workflows.site.modify_site
"
,
"
modify_site
"
)
LazyWorkflowInstance
(
"
gso.workflows.site.terminate_site
"
,
"
terminate_site
"
)
...
...
This diff is collapsed.
Click to expand it.
gso/workflows/shared/__init__.py
0 → 100644
+
1
−
0
View file @
b558f418
"""
Workflows that are shared across multiple products.
"""
This diff is collapsed.
Click to expand it.
gso/workflows/shared/cancel_subscription.py
0 → 100644
+
47
−
0
View file @
b558f418
"""
Cancel a subscription that is in the initial lifecycle state.
"""
from
orchestrator.forms
import
FormPage
from
orchestrator.forms.validators
import
Label
from
orchestrator.targets
import
Target
from
orchestrator.types
import
FormGenerator
,
SubscriptionLifecycle
,
UUIDstr
from
orchestrator.workflow
import
StepList
,
done
,
init
,
workflow
from
orchestrator.workflows.steps
import
resync
,
set_status
,
store_process_subscription
,
unsync
from
orchestrator.workflows.utils
import
wrap_modify_initial_input_form
def
_initial_input_form
(
subscription_id
:
UUIDstr
)
->
FormGenerator
:
class
CancelSubscriptionForm
(
FormPage
):
info_label
:
Label
=
f
"
Canceling subscription with ID
{
subscription_id
}
"
# type:ignore[assignment]
info_label_2
:
Label
=
(
"
This will immediately mark the subscription as terminated, preventing any other workflows from interacting
"
"
with this product subscription.
"
)
info_label_3
:
Label
=
"
ONLY EXECUTE THIS WORKFLOW WHEN YOU ARE ABSOLUTELY SURE WHAT YOU ARE DOING.
"
info_label_4
:
Label
=
"
THIS WORKFLOW IS IRREVERSIBLE AND MAY HAVE UNFORESEEN CONSEQUENCES.
"
yield
CancelSubscriptionForm
return
{
"
subscription_id
"
:
subscription_id
}
@workflow
(
"
Cancel an initial subscription
"
,
initial_input_form
=
wrap_modify_initial_input_form
(
_initial_input_form
),
target
=
Target
.
TERMINATE
,
)
def
cancel_subscription
()
->
StepList
:
"""
Cancel an initial subscription, taking it from the ``INITIAL`` state straight to ``TERMINATED``.
This workflow can be used when a creation workflow has failed, and the process needs to be restarted. This workflow
will prevent a stray subscription, forever stuck in the initial state, to stick around.
* Update the subscription lifecycle state to ``TERMINATED``.
"""
return
(
init
>>
store_process_subscription
(
Target
.
TERMINATE
)
>>
unsync
>>
set_status
(
SubscriptionLifecycle
.
TERMINATED
)
>>
resync
>>
done
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment