From 159cd77ce86643525b4970b9175f468921d5a42f Mon Sep 17 00:00:00 2001 From: Jake Schuurmans <143427381+jakeschuurmans@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:16:59 -0500 Subject: [PATCH] FS-1240; Update firmwareinstall active condition http error (#184) * FS-1240; Update firmwareinstall active condition http error from 400 to 409 so it is less vague --- cmd/orchestrator.go | 2 +- cmd/server.go | 2 +- pkg/api/v1/client/client_test.go | 2 +- pkg/api/v1/routes/handlers.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/orchestrator.go b/cmd/orchestrator.go index 9ff29417..569fc13e 100644 --- a/cmd/orchestrator.go +++ b/cmd/orchestrator.go @@ -26,7 +26,7 @@ var ( var cmdOrchestrator = &cobra.Command{ Use: "orchestrator", Short: "Run condition orchestrator service", - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { app, termCh, err := app.New(cmd.Context(), model.AppKindOrchestrator, cfgFile, model.LogLevel(logLevel)) if err != nil { log.Fatal(err) diff --git a/cmd/server.go b/cmd/server.go index 868a05ed..c2cb442e 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -28,7 +28,7 @@ var shutdownTimeout = 10 * time.Second var cmdServer = &cobra.Command{ Use: "server", Short: "Run condition orchestrator API service", - Run: func(cmd *cobra.Command, args []string) { + Run: func(cmd *cobra.Command, _ []string) { app, termCh, err := app.New(cmd.Context(), model.AppKindServer, cfgFile, model.LogLevel(logLevel)) if err != nil { log.Fatal(err) diff --git a/pkg/api/v1/client/client_test.go b/pkg/api/v1/client/client_test.go index c4b6aae3..cd871108 100644 --- a/pkg/api/v1/client/client_test.go +++ b/pkg/api/v1/client/client_test.go @@ -382,7 +382,7 @@ func TestFirmwareInstall(t *testing.T) { func() *v1types.ServerResponse { return &v1types.ServerResponse{ Message: "server has an active condition", - StatusCode: 400, + StatusCode: 409, } }, "", diff --git a/pkg/api/v1/routes/handlers.go b/pkg/api/v1/routes/handlers.go index 2ab67ffd..263aa3e0 100644 --- a/pkg/api/v1/routes/handlers.go +++ b/pkg/api/v1/routes/handlers.go @@ -335,7 +335,7 @@ func (r *Routes) firmwareInstall(c *gin.Context) (int, *v1types.ServerResponse) if err = r.repository.CreateMultiple(otelCtx, serverID, fwCondition, invCondition); err != nil { if errors.Is(err, store.ErrActiveCondition) { - return http.StatusBadRequest, &v1types.ServerResponse{ + return http.StatusConflict, &v1types.ServerResponse{ Message: err.Error(), } }