From d0dfa93bb41add74220345383743f6c7ef32754c Mon Sep 17 00:00:00 2001 From: Belinda Liu <bliu@pivotal.io> Date: Mon, 6 Jan 2020 16:44:51 -0800 Subject: [PATCH] v7: Align restart behavior with push & restage - During a non-rolling restart, `cf restart` would previously ignore the no-wait flag. This is inconsistent with the behavior of `cf push` and now `cf restage`. - This commit ensures that `cf restart` respects the value of the no-wait flag, whether or not the deployment strategy is set to rolling. - This commit also makes helper methods in the restart command private since they are not used elsewhere. [#169413098] Co-authored-by: Belinda Liu <bliu@pivotal.io> --- command/v7/restart_command.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/command/v7/restart_command.go b/command/v7/restart_command.go index 825e29102b..7c4dcf4b1e 100644 --- a/command/v7/restart_command.go +++ b/command/v7/restart_command.go @@ -76,9 +76,9 @@ func (cmd RestartCommand) Execute(args []string) error { }) switch cmd.Strategy.Name { case constant.DeploymentStrategyRolling: - err = cmd.ZeroDowntimeRestart(app) + err = cmd.zeroDowntimeRestart(app) default: - err = cmd.DowntimeRestart(app) + err = cmd.downtimeRestart(app) } if err != nil { return err @@ -99,7 +99,7 @@ func (cmd RestartCommand) Execute(args []string) error { return nil } -func (cmd RestartCommand) DowntimeRestart(app v7action.Application) error { +func (cmd RestartCommand) downtimeRestart(app v7action.Application) error { var warnings v7action.Warnings var err error if app.Started() { @@ -119,12 +119,12 @@ func (cmd RestartCommand) DowntimeRestart(app v7action.Application) error { } cmd.UI.DisplayText("Waiting for app to start...\n") - warnings, err = cmd.Actor.PollStart(app.GUID, false) + warnings, err = cmd.Actor.PollStart(app.GUID, cmd.NoWait) cmd.UI.DisplayWarnings(warnings) return err } -func (cmd RestartCommand) ZeroDowntimeRestart(app v7action.Application) error { +func (cmd RestartCommand) zeroDowntimeRestart(app v7action.Application) error { cmd.UI.DisplayText("Creating deployment for app {{.AppName}}...\n", map[string]interface{}{ "AppName": cmd.RequiredArgs.AppName, -- GitLab