Skip to content
Snippets Groups Projects
Commit d0dfa93b authored by Belinda Liu's avatar Belinda Liu Committed by Supraja Narasimhan
Browse files

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: default avatarBelinda Liu <bliu@pivotal.io>
parent fae44fde
No related branches found
No related tags found
No related merge requests found
...@@ -76,9 +76,9 @@ func (cmd RestartCommand) Execute(args []string) error { ...@@ -76,9 +76,9 @@ func (cmd RestartCommand) Execute(args []string) error {
}) })
switch cmd.Strategy.Name { switch cmd.Strategy.Name {
case constant.DeploymentStrategyRolling: case constant.DeploymentStrategyRolling:
err = cmd.ZeroDowntimeRestart(app) err = cmd.zeroDowntimeRestart(app)
default: default:
err = cmd.DowntimeRestart(app) err = cmd.downtimeRestart(app)
} }
if err != nil { if err != nil {
return err return err
...@@ -99,7 +99,7 @@ func (cmd RestartCommand) Execute(args []string) error { ...@@ -99,7 +99,7 @@ func (cmd RestartCommand) Execute(args []string) error {
return nil return nil
} }
func (cmd RestartCommand) DowntimeRestart(app v7action.Application) error { func (cmd RestartCommand) downtimeRestart(app v7action.Application) error {
var warnings v7action.Warnings var warnings v7action.Warnings
var err error var err error
if app.Started() { if app.Started() {
...@@ -119,12 +119,12 @@ func (cmd RestartCommand) DowntimeRestart(app v7action.Application) error { ...@@ -119,12 +119,12 @@ func (cmd RestartCommand) DowntimeRestart(app v7action.Application) error {
} }
cmd.UI.DisplayText("Waiting for app to start...\n") 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) cmd.UI.DisplayWarnings(warnings)
return err 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", cmd.UI.DisplayText("Creating deployment for app {{.AppName}}...\n",
map[string]interface{}{ map[string]interface{}{
"AppName": cmd.RequiredArgs.AppName, "AppName": cmd.RequiredArgs.AppName,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment