Skip to content

Commit

Permalink
(cmd): unhide client agent commands (#5097)
Browse files Browse the repository at this point in the history
  • Loading branch information
irenarindos authored Sep 11, 2024
1 parent 15d440a commit 83b6127
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 2 additions & 4 deletions internal/cmd/commands/clientagentcmd/addtoken.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ func addToken(ctx context.Context, apiClient *api.Client, port uint16) (*api.Res
client.RetryWaitMin = 100 * time.Millisecond
client.RetryWaitMax = 1500 * time.Millisecond

// TODO (ICU-13140): Until we release the client agent, do not retry attempts
// to connect to the client agent since it adds a noticeably long delay to
// the command.
client.RetryMax = 0
// Explicitly setting this to 1, since this runs after every command and we don't want any delays
client.RetryMax = 1

req, err := retryablehttp.NewRequestWithContext(ctx, "POST", clientAgentUrl(port, "v1/tokens"),
retryablehttp.ReaderFunc(func() (io.Reader, error) {
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/commands/clientagentcmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ func (c *StatusCommand) Status(ctx context.Context) (*api.Response, *GetStatusRe
client.Logger = nil
client.RetryWaitMin = 100 * time.Millisecond
client.RetryWaitMax = 1500 * time.Millisecond
client.RetryMax = 1

req, err := retryablehttp.NewRequestWithContext(ctx, "GET", clientAgentUrl(c.FlagClientAgentPort, "v1/status"), nil)
if err != nil {
Expand Down
15 changes: 12 additions & 3 deletions internal/cmd/commands/clientagentcmd/wrapper_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,23 @@ package clientagentcmd

import (
"context"
"os"
"strings"

"github.com/hashicorp/boundary/internal/cmd/base"
"github.com/hashicorp/boundary/internal/cmd/wrapper"
)

// TODO (ICU-13140): Remove this and re-enable error output for background
// client agent token sending.
const allowErrorOutput = false
var allowErrorOutput = false

const EnvBoundaryClientAgentCliErrorOutput = "BOUNDARY_CLIENT_AGENT_CLI_ERROR_OUTPUT"

func init() {
errOutput := os.Getenv(EnvBoundaryClientAgentCliErrorOutput)
if strings.ToLower(errOutput) == "true" {
allowErrorOutput = true
}
}

func init() {
if err := wrapper.RegisterSuccessfulCommandCallback("client-agent", hook); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func RunCustom(args []string, runOpts *RunOptions) (exitCode int) {

initCommands(ui, serverCmdUi, runOpts)

hiddenCommands := []string{"version", "client-agent", "client-agent status", "client-agent pause", "client-agent resume", "client-agent sessions"}
hiddenCommands := []string{"version"}

cli := &cli.CLI{
Name: "boundary",
Expand Down

0 comments on commit 83b6127

Please sign in to comment.