From ceccdd7440840fd2449b3888476fce3424405330 Mon Sep 17 00:00:00 2001 From: Fabien FLEUREAU Date: Wed, 22 Jan 2025 17:03:40 +0100 Subject: [PATCH] feat(ENG-1883): update after review --- cmd/application_stop.go | 9 ++------- cmd/container_stop.go | 7 +------ cmd/cronjob_stop.go | 9 ++------- cmd/database_stop.go | 9 ++------- cmd/environment_stop.go | 2 +- cmd/helm_stop.go | 9 ++------- cmd/lifecycle_stop.go | 9 ++------- 7 files changed, 12 insertions(+), 42 deletions(-) diff --git a/cmd/application_stop.go b/cmd/application_stop.go index 7c640c7..1211e1f 100644 --- a/cmd/application_stop.go +++ b/cmd/application_stop.go @@ -37,19 +37,14 @@ var applicationStopCmd = &cobra.Command{ }). Execute() checkError(err) + utils.Println(fmt.Sprintf("Request to stop application(s) %s has been queued...", pterm.FgBlue.Sprintf("%s%s", applicationName, applicationNames))) if watchFlag { utils.WatchEnvironment(envId, "unused", client) - } else { - if applicationName != "" { - utils.Println(fmt.Sprintf("Request to stop application %s has been queued...", pterm.FgBlue.Sprintf("%s", applicationName))) - } else { - utils.Println(fmt.Sprintf("Request to stop applications %s has been queued...", pterm.FgBlue.Sprintf("%s", applicationNames))) - } } return } - // TODO once deployment queue is enabled for all organizations, remove the following code block + // TODO(ENG-1883) once deployment queue is enabled for all organizations, remove the following code block applications, _, err := client.ApplicationsAPI.ListApplication(context.Background(), envId).Execute() checkError(err) diff --git a/cmd/container_stop.go b/cmd/container_stop.go index 386c545..61e4b6e 100644 --- a/cmd/container_stop.go +++ b/cmd/container_stop.go @@ -37,14 +37,9 @@ var containerStopCmd = &cobra.Command{ }). Execute() checkError(err) + utils.Println(fmt.Sprintf("Request to stop container(s) %s has been queued...", pterm.FgBlue.Sprintf("%s%s", containerName, containerNames))) if watchFlag { utils.WatchEnvironment(envId, "unused", client) - } else { - if containerName != "" { - utils.Println(fmt.Sprintf("Request to stop container %s has been queued...", pterm.FgBlue.Sprintf("%s", containerName))) - } else { - utils.Println(fmt.Sprintf("Request to stop containers %s has been queued...", pterm.FgBlue.Sprintf("%s", containerNames))) - } } return } diff --git a/cmd/cronjob_stop.go b/cmd/cronjob_stop.go index b88120e..4cb7cea 100644 --- a/cmd/cronjob_stop.go +++ b/cmd/cronjob_stop.go @@ -38,18 +38,13 @@ var cronjobStopCmd = &cobra.Command{ }). Execute() checkError(err) + utils.Println(fmt.Sprintf("Request to stop cronjob(s) %s has been queued...", pterm.FgBlue.Sprintf("%s%s", cronjobName, cronjobNames))) if watchFlag { utils.WatchEnvironment(envId, "unused", client) - } else { - if cronjobName != "" { - utils.Println(fmt.Sprintf("Request to stop cronjob %s has been queued...", pterm.FgBlue.Sprintf("%s", cronjobName))) - } else { - utils.Println(fmt.Sprintf("Request to stop cronjobs %s has been queued...", pterm.FgBlue.Sprintf("%s", cronjobNames))) - } } return } - // TODO once deployment queue is enabled for all organizations, remove the following code block + // TODO(ENG-1883) once deployment queue is enabled for all organizations, remove the following code block if cronjobNames != "" { // wait until service is ready diff --git a/cmd/database_stop.go b/cmd/database_stop.go index 9f6443a..a4f7b5d 100644 --- a/cmd/database_stop.go +++ b/cmd/database_stop.go @@ -39,19 +39,14 @@ var databaseStopCmd = &cobra.Command{ }). Execute() checkError(err) + utils.Println(fmt.Sprintf("Request to stop databases %s has been queued...", pterm.FgBlue.Sprintf("%s%s", databaseName, databaseNames))) if watchFlag { utils.WatchEnvironment(envId, "unused", client) - } else { - if databaseName != "" { - utils.Println(fmt.Sprintf("Request to stop database %s has been queued...", pterm.FgBlue.Sprintf("%s", databaseName))) - } else { - utils.Println(fmt.Sprintf("Request to stop databases %s has been queued...", pterm.FgBlue.Sprintf("%s", databaseNames))) - } } return } - // TODO once deployment queue is enabled for all organizations, remove the following code block + // TODO(ENG-1883) once deployment queue is enabled for all organizations, remove the following code block if databaseNames != "" { // wait until service is ready diff --git a/cmd/environment_stop.go b/cmd/environment_stop.go index 420ffbb..6f4d8b6 100644 --- a/cmd/environment_stop.go +++ b/cmd/environment_stop.go @@ -38,7 +38,7 @@ var environmentStopCmd = &cobra.Command{ return } - // TODO once deployment queue is enabled for all organizations, remove the following code block + // TODO(ENG-1883) once deployment queue is enabled for all organizations, remove the following code block // wait until service is ready for { diff --git a/cmd/helm_stop.go b/cmd/helm_stop.go index 511c857..1350ce0 100644 --- a/cmd/helm_stop.go +++ b/cmd/helm_stop.go @@ -38,19 +38,14 @@ var helmStopCmd = &cobra.Command{ }). Execute() checkError(err) + utils.Println(fmt.Sprintf("Request to stop helm(s) %s has been queued...", pterm.FgBlue.Sprintf("%s%s", helmName, helmNames))) if watchFlag { utils.WatchEnvironment(envId, "unused", client) - } else { - if helmName != "" { - utils.Println(fmt.Sprintf("Request to stop helm %s has been queued...", pterm.FgBlue.Sprintf("%s", helmName))) - } else { - utils.Println(fmt.Sprintf("Request to stop helms %s has been queued...", pterm.FgBlue.Sprintf("%s", helmNames))) - } } return } - // TODO once deployment queue is enabled for all organizations, remove the following code block + // TODO(ENG-1883) once deployment queue is enabled for all organizations, remove the following code block if helmNames != "" { // wait until service is ready for { diff --git a/cmd/lifecycle_stop.go b/cmd/lifecycle_stop.go index 82f47a9..eb5c3ee 100644 --- a/cmd/lifecycle_stop.go +++ b/cmd/lifecycle_stop.go @@ -39,19 +39,14 @@ var lifecycleStopCmd = &cobra.Command{ }). Execute() checkError(err) + utils.Println(fmt.Sprintf("Request to stop lifecyclejob(s) %s has been queued...", pterm.FgBlue.Sprintf("%s%s", lifecycleName, lifecycleNames))) if watchFlag { utils.WatchEnvironment(envId, "unused", client) - } else { - if lifecycleName != "" { - utils.Println(fmt.Sprintf("Request to stop lifecyclejob %s has been queued...", pterm.FgBlue.Sprintf("%s", lifecycleName))) - } else { - utils.Println(fmt.Sprintf("Request to stop lifecyclejobs %s has been queued...", pterm.FgBlue.Sprintf("%s", lifecycleNames))) - } } return } - // TODO once deployment queue is enabled for all organizations, remove the following code block + // TODO(ENG-1883) once deployment queue is enabled for all organizations, remove the following code block if lifecycleNames != "" { // wait until service is ready