From 09ff7fc24c06b9304eb1fc841bd55a8d64543992 Mon Sep 17 00:00:00 2001 From: Karel van Klink <karel.vanklink@geant.org> Date: Tue, 16 May 2023 10:52:13 +0200 Subject: [PATCH] update formatting of provisioning_proxy pages --- gso/services/provisioning_proxy.py | 21 +++++++++++++-------- gso/workflows/device/create_device.py | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gso/services/provisioning_proxy.py b/gso/services/provisioning_proxy.py index 12439929..20ec4a9d 100644 --- a/gso/services/provisioning_proxy.py +++ b/gso/services/provisioning_proxy.py @@ -4,6 +4,7 @@ import logging import requests from orchestrator import inputstep from orchestrator.config.assignee import Assignee +from orchestrator.domain import SubscriptionModel # noinspection PyProtectedMember from orchestrator.forms import FormPage, ReadOnlyField from orchestrator.forms.validators import Accept, Label, LongText @@ -67,7 +68,8 @@ def _send_request(endpoint: str, parameters: dict, process_id: UUIDstr, request = requests.delete(url, json=parameters) if request.status_code != 200: - raise AssertionError(request.text) + print(request.content) + raise AssertionError(request.content) def provision_device( @@ -162,15 +164,16 @@ def deprovision_ip_trunk(subscription: Iptrunk, @inputstep('Await provisioning proxy results', assignee=Assignee('SYSTEM')) -def await_pp_results() -> State: +def await_pp_results(subscription: SubscriptionModel) -> State: class ProvisioningResultPage(FormPage): class Config: - title = 'Do NOT click on confirm in this step!' + title = f'Deploying {subscription.product.name}...' - warning_label: Label = 'This step relies on an external service to ' \ - 'send an update to the orchestrator, do not ' \ - 'interfere with this process please.' - pp_run_results: dict = {'state': 'not_ready'} + warning_label: Label = f'{subscription.product.description} is being' \ + f' deployed right now. Feel free to refresh ' \ + f'this page every now and again. Just be ' \ + f'sure that you do NOT click submit!' + pp_run_results: dict = None confirm: Accept = Accept('INCOMPLETE') result_page = yield ProvisioningResultPage @@ -182,7 +185,9 @@ def await_pp_results() -> State: def confirm_pp_results(state: State) -> State: class ConfirmRunPage(FormPage): class Config: - title = 'Execution completed, please confirm the results.' + title = f"Execution for " \ + f"{state['subscription']['product']['name']} " \ + f"completed, please confirm the results below." run_status: str = ReadOnlyField(state['pp_run_results']['status']) run_results: LongText = ReadOnlyField( diff --git a/gso/workflows/device/create_device.py b/gso/workflows/device/create_device.py index 76a37e89..1a50b85e 100644 --- a/gso/workflows/device/create_device.py +++ b/gso/workflows/device/create_device.py @@ -122,8 +122,8 @@ def initialize_subscription( '.geant.net') subscription.device.device_fqdn = fqdn subscription.device.device_role = device_role - subscription.description = f'Device {fqdn} type \ - ({subscription.device_type})' + subscription.description = f'Device {fqdn} ' \ + f'({subscription.device_type})' subscription = device.DeviceProvisioning.from_other_lifecycle( subscription, SubscriptionLifecycle.PROVISIONING ) -- GitLab