Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
cli: only allow destroy of successful deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
pearkes committed Jun 3, 2020
1 parent fb494df commit df14998
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/cli/deployment_destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func (c *DeploymentDestroyCommand) Run(args []string) int {
return ErrSentinel
}

// Can't destroy a deployment that was not successful
if deployment.Status.GetState() != pb.Status_SUCCESS {
app.UI.Output("Cannot destroy deployment that is not successful", terminal.WithErrorStyle())
return ErrSentinel
}

if err := app.DestroyDeploy(ctx, deployment); err != nil {
app.UI.Output("Error destroying the deployment: %s", err.Error(), terminal.WithErrorStyle())
return ErrSentinel
Expand Down

0 comments on commit df14998

Please sign in to comment.