Skip to content
Snippets Groups Projects
Commit a26ae196 authored by Andrew Kapuscinski's avatar Andrew Kapuscinski
Browse files

WS-999: actually seal the capability request when a version is cancelled without any executions

parent 88a4281c
No related branches found
No related tags found
1 merge request!882WS-999: actually seal the capability request when a version is cancelled without any executions
Pipeline #4817 passed
......@@ -73,6 +73,7 @@ pyproject.toml
package-lock.json
**/.hypothesis
apps/cli/executables/pexable/deliver/delivery.json
services/workflow/reacquire.txt
# Ignore docker volume mount points
services/**/**/apps
......
......@@ -20,6 +20,7 @@ File containing definitions for the capability version routes of the Workspaces
"""
import copy
import logging
import requests
from pycapo import CapoConfig
......@@ -33,6 +34,8 @@ from pyramid.request import Request
from pyramid.response import Response
from pyramid.view import view_config
logger = logging.getLogger(__name__)
from workspaces.capability.enums import CapabilityVersionState
......@@ -197,9 +200,17 @@ def cancel_capability_version(request: Request) -> Response:
return Response(body=f"Capability request #{capability_request_id} v{version_number} successfully cancelled.")
elif version:
if version.state == "Created":
cap_request = request.capability_info.lookup_capability_request(version.capability_request_id)
# Set version to Cancelled state
version.state = CapabilityVersionState.Cancelled.name
# Seal both version and requests
version.sealed = True
cap_request.sealed = True
# Save
request.capability_info.save_version(version)
request.capability_info.save_entity(cap_request)
return Response(
body=f"Capability request #{capability_request_id} v{version_number} successfully cancelled."
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment