diff --git a/.changelog/17847.txt b/.changelog/17847.txt new file mode 100644 index 00000000000..7bbee3d3f39 --- /dev/null +++ b/.changelog/17847.txt @@ -0,0 +1,3 @@ +```release-note:bug +consul: Fixed a bug where Nomad would repeatedly try to revoke successfully revoked SI tokens +``` diff --git a/nomad/consul.go b/nomad/consul.go index a20074ab1f3..8dc44d64b6a 100644 --- a/nomad/consul.go +++ b/nomad/consul.go @@ -416,8 +416,10 @@ func (c *consulACLsAPI) singleRevoke(ctx context.Context, accessor *structs.SITo return err } - // Consul will no-op the deletion of a non-existent token (no error) _, err := c.aclClient.TokenDelete(accessor.AccessorID, &api.WriteOptions{Namespace: accessor.ConsulNamespace}) + if err != nil && strings.Contains(err.Error(), "Cannot find token to delete") { + return nil // Consul will error when deleting a non-existent token + } return err }