Skip to content

Commit

Permalink
removed caas from delete
Browse files Browse the repository at this point in the history
  • Loading branch information
aahel committed Sep 26, 2023
1 parent c32de38 commit a967c8a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
13 changes: 0 additions & 13 deletions consul/key_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,6 @@ func (c *keyClient) Cas(path, value string, flags int, cas int) (bool, error) {
return written, nil
}

func (c *keyClient) DeleteCas(path string, cas int) (bool, error) {
log.Printf(
"[DEBUG] Deleting key '%s' in %s with cas %d",
path, c.wOpts.Datacenter, cas,
)
pair := consulapi.KVPair{Key: path, ModifyIndex: uint64(cas)}
written, _, err := c.client.DeleteCAS(&pair, c.wOpts)
if err != nil {
return false, fmt.Errorf("failed to delete Consul key '%s': %s", path, err)
}
return written, nil
}

func (c *keyClient) Delete(path string) error {
log.Printf(
"[DEBUG] Deleting key '%s' in %s",
Expand Down
8 changes: 0 additions & 8 deletions consul/resource_consul_keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,6 @@ func resourceConsulKeysDelete(d *schema.ResourceData, meta interface{}) error {
if !ok || !shouldDelete {
continue
}
cas := sub["cas"].(int)
if cas > 0 {
_, err := keyClient.DeleteCas(path, cas)
if err != nil {
return err
}
continue
}
if err := keyClient.Delete(path); err != nil {
return err
}
Expand Down

0 comments on commit a967c8a

Please sign in to comment.