cluster-logging-operator icon indicating copy to clipboard operation
cluster-logging-operator copied to clipboard

LOG-6277: Fix LokiStack is not gathered even if it exists.

Open kattz-kawa opened this issue 4 months ago • 5 comments

Description

The must-gather code[1] gathers LokiStack only when "lokistack" wasn't found in the result of "oc get crd". It means that LokiStack isn't gathered even if it exists.

[1] https://github.com/openshift/cluster-logging-operator/blob/b8e2d71d573fca3717c232d3778aa021f63fc15d/must-gather/collection-scripts/gather#L94

The current line should use && instead of ||. This change is important because, in bash, if the left expression of || is true, the right expression is not evaluated. By using &&, the right expression will be evaluated if LokiStack exists, ensuring that the information is gathered correctly.

Here is an example to demonstrate this point:

$ bash -c 'echo first expression || echo second expression'
first expression  # <--- second expression is not evaluated
$ bash -c 'echo first expression && echo second expression'
first expression
second expression

/cc @Clee2691 /assign @jcantrill

Links

JIRA: https://issues.redhat.com/browse/LOG-6277

kattz-kawa avatar Oct 24 '24 22:10 kattz-kawa