Skip to content

Commit

Permalink
Use os.Hostname instead of a dependency that doesn't work on OpenBSD. (
Browse files Browse the repository at this point in the history
  • Loading branch information
ncabatoff authored Dec 10, 2021
1 parent 6fbdf59 commit 0cc6326
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions vault/logical_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"fmt"
"hash"
"net/http"
"os"
"path"
"path/filepath"
"sort"
Expand Down Expand Up @@ -42,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 (
Expand Down Expand Up @@ -3034,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) {
Expand Down Expand Up @@ -4156,10 +4155,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,
Expand Down

0 comments on commit 0cc6326

Please sign in to comment.