From 11b18aa7408c4cfaa6d63a11de0ae84ea6c24bcb Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Sat, 28 Sep 2024 11:41:15 +0200 Subject: [PATCH] Fix createOrUpdate environment with no manager enabled Previously, the abstract manager would still return a successful response of 204, even if the environment was not stored at all. Now, we return a "proper" 500 code if no environment manager is able to handle the request. --- internal/api/environments.go | 1 + internal/environment/abstract_manager.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/api/environments.go b/internal/api/environments.go index ce834384..dee41a9b 100644 --- a/internal/api/environments.go +++ b/internal/api/environments.go @@ -128,6 +128,7 @@ func (e *EnvironmentController) createOrUpdate(writer http.ResponseWriter, reque }) if err != nil { writeInternalServerError(request.Context(), writer, err, dto.ErrorUnknown) + return } if created { diff --git a/internal/environment/abstract_manager.go b/internal/environment/abstract_manager.go index ee2687f1..4d58dcfa 100644 --- a/internal/environment/abstract_manager.go +++ b/internal/environment/abstract_manager.go @@ -49,7 +49,7 @@ func (n *AbstractManager) Get(_ context.Context, _ dto.EnvironmentID, _ bool) (r func (n *AbstractManager) CreateOrUpdate(_ context.Context, _ dto.EnvironmentID, _ dto.ExecutionEnvironmentRequest) ( bool, error, ) { - return false, nil + return false, dto.ErrNotSupported } func (n *AbstractManager) Delete(environmentID dto.EnvironmentID) (bool, error) {