Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use os.Hostname instead of a dependency that doesn't work on OpenBSD. #13389

Merged
merged 2 commits into from
Dec 10, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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