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

(cmd): unhide client agent commands #5097

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
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
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 uint) (*api.Respo
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
irenarindos marked this conversation as resolved.
Show resolved Hide resolved

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
}
}
Comment on lines +15 to +24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if we could pass this down through flags like other configuration values. What do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll do that. I'll open a PR for those changes


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