Skip to content

Commit

Permalink
Correct name for force acquire deploy flag (#656)
Browse files Browse the repository at this point in the history
## Changes
As discussed here, the name for this flag should be `force-lock`:
#578 (comment)

## Tests
Manually and existing tests
  • Loading branch information
shreyas-goenka authored Aug 15, 2023
1 parent 6c644e1 commit 6a843f2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/bundle/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func newDeployCommand() *cobra.Command {
var forceLock bool
var computeID string
cmd.Flags().BoolVar(&force, "force", false, "Force-override Git branch validation.")
cmd.Flags().BoolVar(&forceLock, "force-deploy", false, "Force acquisition of deployment lock.")
cmd.Flags().BoolVar(&forceLock, "force-lock", false, "Force acquisition of deployment lock.")
cmd.Flags().StringVarP(&computeID, "compute-id", "c", "", "Override compute in the deployment with the given compute ID.")

cmd.RunE = func(cmd *cobra.Command, args []string) error {
Expand Down
2 changes: 1 addition & 1 deletion internal/locker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestAccLock(t *testing.T) {
indexOfAnInactiveLocker = i
}
assert.ErrorContains(t, lockerErrs[i], "lock acquired by")
assert.ErrorContains(t, lockerErrs[i], "Use --force to override")
assert.ErrorContains(t, lockerErrs[i], "Use --force-lock to override")
}
}
assert.Equal(t, 1, countActive, "Exactly one locker should successfull acquire the lock")
Expand Down
4 changes: 2 additions & 2 deletions libs/locker/locker.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ func (locker *Locker) assertLockHeld(ctx context.Context) error {
return err
}
if activeLockState.ID != locker.State.ID && !activeLockState.IsForced {
return fmt.Errorf("deploy lock acquired by %s at %v. Use --force to override", activeLockState.User, activeLockState.AcquisitionTime)
return fmt.Errorf("deploy lock acquired by %s at %v. Use --force-lock to override", activeLockState.User, activeLockState.AcquisitionTime)
}
if activeLockState.ID != locker.State.ID && activeLockState.IsForced {
return fmt.Errorf("deploy lock force acquired by %s at %v. Use --force to override", activeLockState.User, activeLockState.AcquisitionTime)
return fmt.Errorf("deploy lock force acquired by %s at %v. Use --force-lock to override", activeLockState.User, activeLockState.AcquisitionTime)
}
return nil
}
Expand Down

0 comments on commit 6a843f2

Please sign in to comment.