Skip to content

internal/olm: make CLI output text more consistent; check resource errors#1902

Merged
estroz merged 11 commits intooperator-framework:masterfrom
estroz:olm-unify-cli-output
Dec 4, 2019
Merged

internal/olm: make CLI output text more consistent; check resource errors#1902
estroz merged 11 commits intooperator-framework:masterfrom
estroz:olm-unify-cli-output

Conversation

@estroz
Copy link
Copy Markdown
Member

@estroz estroz commented Sep 10, 2019

Description of the change: make CLI output text consistent across internal/olm, and return certain resource errors in Status.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 in Status.HasInstalledResources() so any errors that indicate the resource might exist (is not a not-found error) are returned.

@estroz estroz added the olm-integration Issue relates to the OLM integration label Sep 10, 2019
@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 10, 2019
@estroz estroz force-pushed the olm-unify-cli-output branch from 8faa84a to 66fd308 Compare September 10, 2019 19:47
@estroz
Copy link
Copy Markdown
Member Author

estroz commented Sep 10, 2019

/test e2e-aws-helm

@estroz
Copy link
Copy Markdown
Member Author

estroz commented Sep 10, 2019

/test e2e-aws-subcommand

1 similar comment
@estroz
Copy link
Copy Markdown
Member Author

estroz commented Sep 10, 2019

/test e2e-aws-subcommand

Comment thread internal/olm/client/status.go Outdated
@estroz estroz requested a review from joelanford September 12, 2019 18:36
Comment thread internal/olm/client.go
Copy link
Copy Markdown
Contributor

@camilamacedo86 camilamacedo86 left a 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.

Comment thread internal/olm/client/status.go Outdated
Comment thread internal/olm/client/status.go Outdated
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 8, 2019
@estroz estroz force-pushed the olm-unify-cli-output branch from 9485462 to 527a85e Compare November 8, 2019 20:55
@estroz
Copy link
Copy Markdown
Member Author

estroz commented Nov 8, 2019

@joelanford @camilamacedo86 seems to be working now with @joelanford's suggested changes. PTAL.

Copy link
Copy Markdown
Contributor

@camilamacedo86 camilamacedo86 left a 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

Comment thread internal/olm/client/status.go
@estroz estroz force-pushed the olm-unify-cli-output branch from 527a85e to e514942 Compare November 19, 2019 00:31
@camilamacedo86 camilamacedo86 added approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. labels Nov 21, 2019
@openshift-ci-robot
Copy link
Copy Markdown

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 22, 2019
Comment thread internal/olm/client/status.go
Comment thread internal/olm/client.go Outdated
Comment thread internal/olm/client/status.go Outdated
Comment on lines +121 to +130
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
}
Copy link
Copy Markdown
Member

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:

var status *HelmAppStatus
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(s, &status); err != nil {
return &HelmAppStatus{}
}

Comment thread internal/olm/client/status.go
Comment thread 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:" +
Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@camilamacedo86 camilamacedo86 added the lgtm Indicates that a PR is ready to be merged. label Dec 4, 2019
@estroz estroz merged commit 7dab655 into operator-framework:master Dec 4, 2019
@estroz estroz deleted the olm-unify-cli-output branch April 1, 2020 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. olm-integration Issue relates to the OLM integration size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants