From e485ffb38df811d61fa0539eca5f8f9a3563f85b Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Fri, 10 Dec 2021 08:38:48 -0500 Subject: [PATCH 1/2] Use os.Hostname instead of a dependency that doesn't work on OpenBSD. --- vault/logical_system.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/vault/logical_system.go b/vault/logical_system.go index a751439444aa..05b35f1e5611 100644 --- a/vault/logical_system.go +++ b/vault/logical_system.go @@ -11,6 +11,7 @@ import ( "fmt" "hash" "net/http" + "os" "path" "path/filepath" "sort" @@ -4156,10 +4157,14 @@ func (b *SystemBackend) rotateBarrierKey(ctx context.Context) error { func (b *SystemBackend) handleHAStatus(ctx context.Context, req *logical.Request, d *framework.FieldData) (*logical.Response, error) { // We're always the leader if we're handling this request. - h, _ := host.Info() + hostname, err := os.Hostname() + if err != nil { + return nil, err + } + nodes := []HAStatusNode{ { - Hostname: h.Hostname, + Hostname: hostname, APIAddress: b.Core.redirectAddr, ClusterAddress: b.Core.ClusterAddr(), ActiveNode: true, From 177a42289c7a5962f5781c5c12c4cb3c913d9b26 Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Fri, 10 Dec 2021 08:41:08 -0500 Subject: [PATCH 2/2] Actually remove the import. --- vault/logical_system.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/vault/logical_system.go b/vault/logical_system.go index 05b35f1e5611..37b8d11e1bec 100644 --- a/vault/logical_system.go +++ b/vault/logical_system.go @@ -43,7 +43,6 @@ import ( "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/version" "github.com/mitchellh/mapstructure" - "github.com/shirou/gopsutil/host" ) const ( @@ -3035,7 +3034,6 @@ func (b *SystemBackend) handleInFlightRequestData(_ context.Context, req *logica resp.Data[logical.HTTPStatusCode] = http.StatusOK return resp, nil - } func (b *SystemBackend) handleMonitor(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {