Skip to content

Commit

Permalink
fix(cli): Do not error out with no errors (#15688) (#16129)
Browse files Browse the repository at this point in the history
Co-authored-by: Gergely Czuczy <[email protected]>
  • Loading branch information
gcp-cherry-pick-bot[bot] and gczuczy authored Oct 26, 2023
1 parent 266e92e commit 67e1e04
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/argocd/commands/headless/headless.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ func testAPI(ctx context.Context, clientOpts *apiclient.ClientOptions) error {
}
defer io.Close(closer)
_, err = versionClient.Version(ctx, &empty.Empty{})
return fmt.Errorf("failed to get version: %w", err)
if err != nil {
return fmt.Errorf("failed to get version: %w", err)
}
return nil
}

// StartLocalServer allows executing command in a headless mode: on the fly starts Argo CD API server and
Expand Down Expand Up @@ -243,7 +246,10 @@ func StartLocalServer(ctx context.Context, clientOpts *apiclient.ClientOptions,
}
time.Sleep(time.Second)
}
return fmt.Errorf("all retries failed: %w", err)
if err != nil {
return fmt.Errorf("all retries failed: %w", err)
}
return nil
}

// NewClientOrDie creates a new API client from a set of config options, or fails fatally if the new client creation fails.
Expand Down

0 comments on commit 67e1e04

Please sign in to comment.