Skip to content

Commit

Permalink
feat(ENG-1883): update after review
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienfleureau committed Jan 22, 2025
1 parent 0af3443 commit ceccdd7
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 42 deletions.
9 changes: 2 additions & 7 deletions cmd/application_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 1 addition & 6 deletions cmd/container_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
9 changes: 2 additions & 7 deletions cmd/cronjob_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 2 additions & 7 deletions cmd/database_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/environment_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 2 additions & 7 deletions cmd/helm_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 2 additions & 7 deletions cmd/lifecycle_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ceccdd7

Please sign in to comment.