-
Notifications
You must be signed in to change notification settings - Fork 1.8k
internal/olm: make CLI output text more consistent; check resource errors #1902
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
internal/olm: make CLI output text more consistent; check resource errors #1902
Conversation
8faa84a
to
66fd308
Compare
/test e2e-aws-helm |
/test e2e-aws-subcommand |
1 similar comment
/test e2e-aws-subcommand |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All shows great.
Just the nomenclature of the bool func should be changed in order to respect the good practices for Has
instead of NOX.
9485462
to
527a85e
Compare
@joelanford @camilamacedo86 seems to be working now with @joelanford's suggested changes. PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm /approved
when it pass in the CI
527a85e
to
e514942
Compare
New changes are detected. LGTM label has been removed. |
internal/olm/client/status.go
Outdated
vb, err := v.MarshalJSON() | ||
if err != nil { | ||
return nil, err | ||
} | ||
// Use unversioned CustomResourceDefinition to avoid implementing cast | ||
// for all versions. | ||
obj, _, err := dec.Decode(vb, nil, nil) | ||
if err != nil { | ||
return nil, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to use something like this:
operator-sdk/pkg/helm/internal/types/types.go
Lines 138 to 141 in 3c8e5e7
var status *HelmAppStatus | |
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(s, &status); err != nil { | |
return &HelmAppStatus{} | |
} |
internal/olm/client.go
Outdated
return nil, errors.New("detected existing OLM resources: OLM must be completely uninstalled before installation" + | ||
fmt.Sprintf("\nResources:\n%s", status.String())) | ||
} else if err != nil { | ||
return nil, errors.New("detected errored OLM resources:" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joelanford wdyt about "detected errored OLM resources, see resource statuses for more details"
as an alternative error message? I'm hesitant to wrap err
here since it contains error information for only one resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description of the change: make CLI output text consistent across
internal/olm
, and return certain resource errors inStatus.HasInstalledResources()
.Motivation for the change: CLI output is easier to read. Output when running
olm install
on a cluster that already has an OLM deployment now prints existing resource status.Resource.Error
is now also checked inStatus.HasInstalledResources()
so any errors that indicate the resource might exist (is not a not-found error) are returned.