diff --git a/.changelog/17847.txt b/.changelog/17847.txt new file mode 100644 index 000000000000..7bbee3d3f393 --- /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 737e46bdbaf0..1f4a3447badf 100644 --- a/nomad/consul.go +++ b/nomad/consul.go @@ -419,8 +419,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(), "ACL not found") { + return nil // Consul will error when deleting a non-existent token + } return err }