mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Add errors for lock disappearing
This commit is contained in:
parent
e5f7237582
commit
b0f7e273e8
@ -212,14 +212,11 @@ func (c *RemoteClient) Unlock(id string) error {
|
|||||||
|
|
||||||
lease, err := c.getLease(leaseName)
|
lease, err := c.getLease(leaseName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if k8serrors.IsNotFound(err) {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if lease.Spec.HolderIdentity == nil {
|
if lease.Spec.HolderIdentity == nil {
|
||||||
return nil
|
return fmt.Errorf("state is already unlocked")
|
||||||
}
|
}
|
||||||
|
|
||||||
lockInfo, err := c.getLockInfo(lease)
|
lockInfo, err := c.getLockInfo(lease)
|
||||||
@ -245,7 +242,6 @@ func (c *RemoteClient) Unlock(id string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//getLockInfo takes a secret and attempts to read the lockInfo field.
|
|
||||||
func (c *RemoteClient) getLockInfo(lease *coordinationv1.Lease) (*state.LockInfo, error) {
|
func (c *RemoteClient) getLockInfo(lease *coordinationv1.Lease) (*state.LockInfo, error) {
|
||||||
lockData, ok := getLockInfo(lease)
|
lockData, ok := getLockInfo(lease)
|
||||||
if len(lockData) == 0 || !ok {
|
if len(lockData) == 0 || !ok {
|
||||||
|
Loading…
Reference in New Issue
Block a user