Fix force flag not working for bundle destroy (#434)

## 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.
This commit is contained in:
shreyas-goenka 2023-06-19 12:31:07 +02:00 committed by GitHub
parent bb32067a80
commit 4a03265dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -15,7 +15,7 @@ var deployCmd = &cobra.Command{
b := bundle.Get(cmd.Context()) b := bundle.Get(cmd.Context())
// If `--force` is specified, force acquisition of the deployment lock. // 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( return bundle.Apply(cmd.Context(), b, bundle.Seq(
phases.Initialize(), phases.Initialize(),
@ -25,9 +25,9 @@ var deployCmd = &cobra.Command{
}, },
} }
var force bool var forceDeploy bool
func init() { func init() {
AddCommand(deployCmd) AddCommand(deployCmd)
deployCmd.Flags().BoolVar(&force, "force", false, "Force acquisition of deployment lock.") deployCmd.Flags().BoolVar(&forceDeploy, "force", false, "Force acquisition of deployment lock.")
} }

View File

@ -22,7 +22,7 @@ var destroyCmd = &cobra.Command{
b := bundle.Get(ctx) b := bundle.Get(ctx)
// If `--force` is specified, force acquisition of the deployment lock. // 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 // If `--auto-approve`` is specified, we skip confirmation checks
b.AutoApprove = autoApprove b.AutoApprove = autoApprove
@ -51,8 +51,10 @@ var destroyCmd = &cobra.Command{
} }
var autoApprove bool var autoApprove bool
var forceDestroy bool
func init() { func init() {
AddCommand(destroyCmd) AddCommand(destroyCmd)
destroyCmd.Flags().BoolVar(&autoApprove, "auto-approve", false, "Skip interactive approvals for deleting resources and files") 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.")
} }