vault: configure user agent on Nomad vault clients (#15745)

* vault: configure user agent on Nomad vault clients

This PR attempts to set the User-Agent header on each Vault API client
created by Nomad. Still need to figure a way to set User-Agent on the
Vault client created internally by consul-template.

* vault: fixup find-and-replace gone awry
This commit is contained in:
Seth Hoenig
2023-01-10 10:39:45 -06:00
committed by GitHub
parent cab35b3b1c
commit f05aa6d5ec
9 changed files with 56 additions and 17 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/hashicorp/nomad/ci"
"github.com/hashicorp/nomad/helper/testlog"
"github.com/hashicorp/nomad/helper/useragent"
"github.com/hashicorp/nomad/helper/uuid"
"github.com/hashicorp/nomad/nomad/structs/config"
vapi "github.com/hashicorp/vault/api"
@@ -57,6 +58,7 @@ func NewTestVaultFromPath(t testing.T, binary string) *TestVault {
t.Fatalf("failed to build Vault API client: %v", err)
}
client.SetToken(token)
useragent.SetHeaders(client)
enable := true
tv := &TestVault{
@@ -133,6 +135,7 @@ func NewTestVaultDelayed(t testing.T) *TestVault {
t.Fatalf("failed to build Vault API client: %v", err)
}
client.SetToken(token)
useragent.SetHeaders(client)
enable := true
tv := &TestVault{