server/vault: tweak error messages

Closes #5139
This commit is contained in:
Mahmood Ali 2019-01-23 08:03:11 -05:00
parent f3a2d05e11
commit f4560d8a2a
2 changed files with 4 additions and 3 deletions

View File

@ -438,7 +438,7 @@ OUTER:
retryTimer.Reset(v.config.ConnectionRetryIntv) retryTimer.Reset(v.config.ConnectionRetryIntv)
v.l.Lock() v.l.Lock()
v.connEstablished = true v.connEstablished = true
v.connEstablishedErr = fmt.Errorf("Nomad Server failed to establish connections to Vault: %v", err) v.connEstablishedErr = fmt.Errorf("failed to establish connection to Vault: %v", err)
v.l.Unlock() v.l.Unlock()
continue OUTER continue OUTER
} }
@ -517,7 +517,8 @@ func (v *vaultClient) renewalLoop() {
if backoff < 0 { if backoff < 0 {
// We have failed to renew the token past its expiration. Stop // We have failed to renew the token past its expiration. Stop
// renewing with Vault. // renewing with Vault.
v.logger.Error("failed to renew Vault token before lease expiration. Shutting down Vault client") v.logger.Error("failed to renew Vault token before lease expiration. Shutting down Vault client",
"error", err)
v.l.Lock() v.l.Lock()
v.connEstablished = false v.connEstablished = false
v.connEstablishedErr = err v.connEstablishedErr = err

View File

@ -1119,7 +1119,7 @@ func TestVaultClient_CreateToken_Role_InvalidToken(t *testing.T) {
task.Vault = &structs.Vault{Policies: []string{"default"}} task.Vault = &structs.Vault{Policies: []string{"default"}}
_, err = client.CreateToken(context.Background(), a, task.Name) _, err = client.CreateToken(context.Background(), a, task.Name)
if err == nil || !strings.Contains(err.Error(), "Nomad Server failed to establish connections to Vault") { if err == nil || !strings.Contains(err.Error(), "failed to establish connection to Vault") {
t.Fatalf("CreateToken should have failed: %v", err) t.Fatalf("CreateToken should have failed: %v", err)
} }
} }