Skip to content

Commit

Permalink
Fix force flag not working for bundle destroy (#434)
Browse files Browse the repository at this point in the history
## Changes
`--force` flag did not exist for `bundle destroy`. This PR adds that in.

## Tests
manually tested. Now adding the `--force` flag hijacks the deploy lock
on the target directory.
  • Loading branch information
shreyas-goenka authored Jun 19, 2023
1 parent bb32067 commit 4a03265
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cmd/bundle/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var deployCmd = &cobra.Command{
b := bundle.Get(cmd.Context())

// If `--force` is specified, force acquisition of the deployment lock.
b.Config.Bundle.Lock.Force = force
b.Config.Bundle.Lock.Force = forceDeploy

return bundle.Apply(cmd.Context(), b, bundle.Seq(
phases.Initialize(),
Expand All @@ -25,9 +25,9 @@ var deployCmd = &cobra.Command{
},
}

var force bool
var forceDeploy bool

func init() {
AddCommand(deployCmd)
deployCmd.Flags().BoolVar(&force, "force", false, "Force acquisition of deployment lock.")
deployCmd.Flags().BoolVar(&forceDeploy, "force", false, "Force acquisition of deployment lock.")
}
4 changes: 3 additions & 1 deletion cmd/bundle/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var destroyCmd = &cobra.Command{
b := bundle.Get(ctx)

// If `--force` is specified, force acquisition of the deployment lock.
b.Config.Bundle.Lock.Force = force
b.Config.Bundle.Lock.Force = forceDestroy

// If `--auto-approve`` is specified, we skip confirmation checks
b.AutoApprove = autoApprove
Expand Down Expand Up @@ -51,8 +51,10 @@ var destroyCmd = &cobra.Command{
}

var autoApprove bool
var forceDestroy bool

func init() {
AddCommand(destroyCmd)
destroyCmd.Flags().BoolVar(&autoApprove, "auto-approve", false, "Skip interactive approvals for deleting resources and files")
destroyCmd.Flags().BoolVar(&forceDestroy, "force", false, "Force acquisition of deployment lock.")
}

0 comments on commit 4a03265

Please sign in to comment.