Manually build the socket url (#4205)
This commit is contained in:
1 parent
b7e474d277
commit
c94a933578
7 files changed
+17
-30
No files matched your search
@@ -138,11 +138,8 @@ func (c *AddTokenCommand) Add(ctx context.Context, apiClient *api.Client, keyrin
|
||||
}
|
||||
|
||||
func addToken(ctx context.Context, daemonPath string, p *daemon.UpsertTokenRequest, opt ...client.Option) (*api.Response, *api.Error, error) {
|
||||
addr, err := daemon.SocketAddress(daemonPath)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("Error when retrieving the socket address: %w", err)
|
||||
}
|
||||
_, err = os.Stat(addr.Path)
|
||||
addr := daemon.SocketAddress(daemonPath)
|
||||
_, err := os.Stat(addr.Path)
|
||||
if addr.Scheme == "unix" && err != nil {
|
||||
return nil, nil, fmt.Errorf("Error when detecting if the domain socket is present: %w.", err)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
|
||||
"github.com/hashicorp/boundary/internal/clientcache/internal/daemon"
|
||||
"github.com/hashicorp/boundary/internal/cmd/base"
|
||||
"github.com/hashicorp/boundary/internal/errors"
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
@@ -134,10 +133,7 @@ func waitForDaemon(ctx context.Context) error {
|
||||
}
|
||||
timer := time.NewTimer(0)
|
||||
|
||||
addr, err := daemon.SocketAddress(dotPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(ctx, err, op)
|
||||
}
|
||||
addr := daemon.SocketAddress(dotPath)
|
||||
_, err = os.Stat(addr.Path)
|
||||
for os.IsNotExist(err) {
|
||||
select {
|
||||
|
||||
@@ -106,11 +106,8 @@ func (c *StatusCommand) Status(ctx context.Context) (*api.Response, *daemon.Stat
|
||||
|
||||
func status(ctx context.Context, daemonPath string, opt ...client.Option) (*api.Response, *daemon.StatusResult, *api.Error, error) {
|
||||
const op = "daemon.status"
|
||||
addr, err := daemon.SocketAddress(daemonPath)
|
||||
if err != nil {
|
||||
return nil, nil, nil, fmt.Errorf("Error getting socket address: %w", err)
|
||||
}
|
||||
_, err = os.Stat(addr.Path)
|
||||
addr := daemon.SocketAddress(daemonPath)
|
||||
_, err := os.Stat(addr.Path)
|
||||
if addr.Scheme == "unix" && err != nil {
|
||||
return nil, nil, nil, errDaemonNotRunning
|
||||
}
|
||||
|
||||
@@ -66,11 +66,7 @@ func (s *StopCommand) stop(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func stopThroughHandler(ctx context.Context, dotPath string) (*api.Error, error) {
|
||||
addr, err := daemon.SocketAddress(dotPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error when retrieving the socket address: %w", err)
|
||||
}
|
||||
|
||||
addr := daemon.SocketAddress(dotPath)
|
||||
c, err := client.New(ctx, addr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user