Skip to content
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

improve GetCluster message when Subscription exists but is inactive #518

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

cben
Copy link
Contributor

@cben cben commented Jul 4, 2023

First step towards #517.
At least doesn't lie to user and gives hint how to find past data:

before

> ocm describe cluster 0e68a621-c00e-4bbf-a4bb-9915ae6cc947
Error: Can't retrieve cluster for key '0e68a621-c00e-4bbf-a4bb-9915ae6cc947': There are no subscriptions or clusters with identifier or name '0e68a621-c00e-4bbf-a4bb-9915ae6cc947'

after

> ocm describe cluster 0e68a621-c00e-4bbf-a4bb-9915ae6cc947
Error: Can't retrieve cluster for key '0e68a621-c00e-4bbf-a4bb-9915ae6cc947': Cluster was Deprovisioned, see `ocm get subscription 2S434jffVG4fSgDdK4cbkDTxVNp` for details``

This affects ALL commands that use GetCluster helper.

❓ Behavior change: when there is 1 active cluster and also 1+ past clusters reusing same display_name, previously the active one was silently used; now will refuse treating them as ambiguous:

> ocm get subs -p search="display_name in ('servheredia')" | jq .items[].status | sort | uniq -c
      4 "Deprovisioned"
      1 "Reserved"
> ocm describe cluster servheredia
Error: Can't retrieve cluster for key 'servheredia': There are 5 subscriptions with cluster identifier or name 'servheredia'

is that desired?

First step towards openshift-online#517.
At least doesn't lie to user and gives hint how to find past data:

Error: Can't retrieve cluster for key '0e68a621-c00e-4bbf-a4bb-9915ae6cc947': Cluster was Deprovisioned, see `ocm get subscription 2S434jffVG4fSgDdK4cbkDTxVNp` for details

This affects ALL commands that use `GetCluster` helper.

Behavior change: when there is 1 active cluster and also 1+ past clusters
reusing same display_name, previously the active one was used;
now will refuse treating them as ambiguous:

> ocm get subs -p search="display_name in ('servheredia')" | jq .items[].status | sort | uniq -c
      4 "Deprovisioned"
      1 "Reserved"
> ocm describe cluster servheredia
Error: Can't retrieve cluster for key 'servheredia': There are 5 subscriptions with cluster identifier or name 'servheredia'
@gdbranco gdbranco merged commit 87c91ab into openshift-online:main Jul 21, 2023
@mjlshen
Copy link
Contributor

mjlshen commented Oct 4, 2023

I'm curious about this change:

❓ Behavior change: when there is 1 active cluster and also 1+ past clusters reusing same display_name, previously the active one was silently used; now will refuse treating them as ambiguous:

The behavior of ocm describe cluster to just show the active cluster was desired by me. When I spin up a test cluster I tend to keep the same name, so now when I want to us ocm describe cluster I would have to use one of the IDs instead which are unpredictable.

I appreciate that we want a way to query archived clusters with ocm cli - but is there a flag we can add to keep the old behavior, maybe --active? Alternatively, the opposite and keeping the old behavior by default and adding a --archives?

@cben
Copy link
Contributor Author

cben commented Oct 4, 2023

When I spin up a test cluster I tend to keep the same name

Good point. I'm less involved with ocm-cli now so I'm not the right person to decide this. I recommend opening a new issue.

@cben
Copy link
Contributor Author

cben commented Oct 4, 2023

Or bring this up on #517. One of the open questions there was that many commands using GetCluster() only make sense on Active clusters...
(This PR was not so much a solution as provocation to explore the question 😉)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants