Add errors for lock disappearing

This commit is contained in:
John Houston 2020-06-05 18:10:24 -04:00
parent e5f7237582
commit b0f7e273e8
1 changed files with 1 additions and 5 deletions

View File

@ -212,14 +212,11 @@ func (c *RemoteClient) Unlock(id string) error {
lease, err := c.getLease(leaseName)
if err != nil {
if k8serrors.IsNotFound(err) {
return nil
}
return err
}
if lease.Spec.HolderIdentity == nil {
return nil
return fmt.Errorf("state is already unlocked")
}
lockInfo, err := c.getLockInfo(lease)
@ -245,7 +242,6 @@ func (c *RemoteClient) Unlock(id string) error {
return nil
}
//getLockInfo takes a secret and attempts to read the lockInfo field.
func (c *RemoteClient) getLockInfo(lease *coordinationv1.Lease) (*state.LockInfo, error) {
lockData, ok := getLockInfo(lease)
if len(lockData) == 0 || !ok {