backport of commit ab36cf031c80253d9c2827852f8ecbeae3d6ff5b (#19027)

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
This commit is contained in:
hc-github-team-nomad-core 2023-11-07 19:15:31 -06:00 committed by GitHub
parent 9634ef7bb2
commit c160ce99e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

3
.changelog/18985.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
vault: Fixed an issue that could cause Nomad to attempt to renew a Vault token that is already expired
```

View File

@ -391,6 +391,7 @@ func (c *vaultClient) renew(req *vaultClientRenewalRequest) error {
fatal := false fatal := false
if renewalErr != nil && if renewalErr != nil &&
(strings.Contains(renewalErr.Error(), "lease not found or lease is not renewable") || (strings.Contains(renewalErr.Error(), "lease not found or lease is not renewable") ||
strings.Contains(renewalErr.Error(), "invalid lease ID") ||
strings.Contains(renewalErr.Error(), "lease is not renewable") || strings.Contains(renewalErr.Error(), "lease is not renewable") ||
strings.Contains(renewalErr.Error(), "token not found") || strings.Contains(renewalErr.Error(), "token not found") ||
strings.Contains(renewalErr.Error(), "permission denied")) { strings.Contains(renewalErr.Error(), "permission denied")) {