Skip to content
Open
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
10 changes: 3 additions & 7 deletions pkg/cli/admin/mustgather/mustgather.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (o *MustGatherOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, arg
}
// TODO: this should be in Validate() method, but added here because of the call to o.completeImages() below
if o.AllImages {
errStr := fmt.Sprintf("and --all-images are mutually exclusive: please specify one or the other")
errStr := "and --all-images are mutually exclusive: please specify one or the other"
if len(o.Images) != 0 {
return fmt.Errorf("--image %s", errStr)
}
Expand Down Expand Up @@ -333,10 +333,7 @@ func (o *MustGatherOptions) completeImages(ctx context.Context) error {
}
if o.AllImages {
// find all csvs and clusteroperators with the annotation "operators.openshift.io/must-gather-image"
pluginImages := make(map[string]struct{})
var err error

pluginImages, err = o.annotatedCSVs(ctx)
pluginImages, err := o.annotatedCSVs(ctx)
if err != nil {
return err
}
Expand Down Expand Up @@ -1340,7 +1337,7 @@ func (o *MustGatherOptions) BackupGathering(ctx context.Context, errs []error) {
fmt.Fprintf(o.ErrOut, "Falling back to `oc adm inspect %s` to collect basic cluster types.\n", typeTargets)

streams := o.IOStreams
streams.Out = o.newPrefixWriter(streams.Out, fmt.Sprintf("[must-gather ] OUT"), false, true)
streams.Out = o.newPrefixWriter(streams.Out, "[must-gather ] OUT", false, true)
destDir := path.Join(o.DestDir, fmt.Sprintf("inspect.local.%06d", rand.Int63()))

if err := runInspect(ctx, streams, rest.CopyConfig(o.Config), destDir, []string{typeTargets}); err != nil {
Expand All @@ -1352,7 +1349,6 @@ func (o *MustGatherOptions) BackupGathering(ctx context.Context, errs []error) {
if err := runInspect(ctx, streams, rest.CopyConfig(o.Config), destDir, namedTargets); err != nil {
fmt.Fprintf(o.ErrOut, "error completing cluster named resource inspection: %v\n", err)
}
return
}

func runInspect(ctx context.Context, streams genericiooptions.IOStreams, config *rest.Config, destDir string, arguments []string) error {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/admin/mustgather/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func humanSummaryForClusterVersion(clusterVersion *configv1.ClusterVersion) stri

lastChangeHumanDuration := "<unknown>"
if len(clusterVersion.Status.History) > 0 {
lastChangeHumanDuration = units.HumanDuration(time.Now().Sub(clusterVersion.Status.History[0].StartedTime.Time))
lastChangeHumanDuration = units.HumanDuration(time.Since(clusterVersion.Status.History[0].StartedTime.Time))
}

progressingConditionMessage := "<unknown>"
Expand All @@ -182,7 +182,7 @@ func humanSummaryForClusterVersion(clusterVersion *configv1.ClusterVersion) stri
case isStable:
return fmt.Sprintf("Stable at %q", clusterVersion.Status.History[0].Version)
default:
return fmt.Sprintf("Unknown state")
return "Unknown state"
}
}

Expand Down