Skip to content

Commit d6bf76f

Browse files
Merge pull request #18873 from openshift-cherrypick-robot/cherry-pick-18714-to-release-3.9
[release-3.9] diagnostics: missing logging project shouldn't be fatal error
2 parents 0279037 + 58dc942 commit d6bf76f

File tree

1 file changed

+7
-2
lines changed
  • pkg/oc/admin/diagnostics/diagnostics/cluster/aggregated_logging

1 file changed

+7
-2
lines changed

pkg/oc/admin/diagnostics/diagnostics/cluster/aggregated_logging/diagnostic.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,22 @@ func (d *AggregatedLogging) Complete(logger *log.Logger) error {
163163
d.Debug("AGL0032", fmt.Sprintf("Project %q not found", project))
164164
continue
165165
}
166-
return fmt.Errorf("failed fetching one of the default logging projects %q: %v", project, err)
166+
d.Error("AGL0034", err, fmt.Sprintf("Fetching project %q returned with error", project))
167+
return nil
167168
}
168169

169170
d.Debug("AGL0033", fmt.Sprintf("Found default logging project %q", project))
170171
d.Project = project
171172
return nil
172173
}
173-
return fmt.Errorf("default logging project not found, use '--%s' to specify logging project", flagLoggingProject)
174+
//tried to complete here but no known logging project exists, will be checked in CanRun()
175+
return nil
174176
}
175177

176178
func (d *AggregatedLogging) CanRun() (bool, error) {
179+
if len(d.Project) == 0 {
180+
return false, errors.New("Logging project does not exist")
181+
}
177182
if d.OAuthClientClient == nil || d.ProjectClient == nil || d.RouteClient == nil || d.CRBClient == nil || d.DCClient == nil {
178183
return false, errors.New("Config must include a cluster-admin context to run this diagnostic")
179184
}

0 commit comments

Comments
 (0)