From c70a78f267fb017ac00c5f05b4b329f44a195931 Mon Sep 17 00:00:00 2001 From: Frederic Date: Wed, 19 May 2021 13:57:28 +0200 Subject: [PATCH] Fallback to generic invocation or display and error when no cloud_provider is found in the functional requirement Fixes #231 --- stackl/core/core/agent_broker/agent_task_broker.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/stackl/core/core/agent_broker/agent_task_broker.py b/stackl/core/core/agent_broker/agent_task_broker.py index 05b584a..79dab42 100644 --- a/stackl/core/core/agent_broker/agent_task_broker.py +++ b/stackl/core/core/agent_broker/agent_task_broker.py @@ -52,6 +52,20 @@ async def create_service(action, redis, stack_instance, to_be_deleted, invoc = {} invoc['action'] = action invoc['functional_requirement'] = fr + if cloud_provider in fr_doc.invocation: + pass + elif "generic" in fr_doc.invocation: + cloud_provider = "generic" + else: + automation_result = {} + automation_result["functional_requirement"] = fr + automation_result["infrastructure_target"] = infrastructure_target + automation_result["service"] = service_name + automation_result["error_message"] = "No cloud provider for this invocation" + automation_result["status"] = "Failed" + await update_status(automation_result, stack_instance, action, + to_be_deleted) + return False invoc['image'] = fr_doc.invocation[cloud_provider].image invoc['before_command'] = fr_doc.invocation[ cloud_provider].before_command