Skip to content

Commit

Permalink
fix(cli): Do not error out with no errors (#15688)
Browse files Browse the repository at this point in the history
  • Loading branch information
gczuczy authored Oct 5, 2023
1 parent ac0ae16 commit c200d0c
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
}

// MaybeStartLocalServer allows executing command in a headless mode. If we're in core mode, starts the Argo CD API
Expand Down Expand Up @@ -249,7 +252,10 @@ func MaybeStartLocalServer(ctx context.Context, clientOpts *apiclient.ClientOpti
}
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 c200d0c

Please sign in to comment.