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

GCS/GCP Subscription ID Management #921

Merged
merged 9 commits into from
Jan 4, 2024

Conversation

derek-globus
Copy link
Contributor

sc-28587

What?

  • Added new globus gcs endpoint set-subscription-id command which allows subscription managers and endpoint admins to modify the subscription ID for a gcs endpoint.
  • Added globus gcp set-subscription-id which aliases existing globus endpoint set-subscription-id command, allowing subscription managers & collection admins to modify the subscription ID for a gcp collection.

Testing

  • Stood up a gcs endpoint in sandbox, tested setting/removing the subscription for:

    1. A user which is an endpoint admin but only subscription member
    2. A user which is a subscription manager but not an endpoint admin
  • Stood up a gcp endpoint in sandbox, tested setting/removing the subscription for:

    1. A user which is a collection admin but only subscription member
    2. A user which is a subscription manager but not a collection admin

"set-subscription-id": (
"endpoint.set_subscription_id",
"set_endpoint_subscription_id",
),
Copy link
Member

Choose a reason for hiding this comment

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

I'm okay with this as a short-term position, but I'd like us to write a new command for this, rather than reusing the existing one.

My reason is primarily helptext and parameter names. If you look at the existing command, you'll see it states

Unlike the '--managed' flag for 'globus endpoint update' ...

Which is not something we want to retain into the future.

I think it's also worth having the new command check to confirm that it's operating on a GCP_mapped_collection rather than a GCP_guest_collection. That way, we more clearly explain to users that it's only possible to use the relevant command on a GCP host, not the shares underneath that host.

I'm perfectly happy for us to pursue that change as a fast-follow to this PR though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially did write a new command for GCP but erased it when it ended up being identical to this one.


If we do add a duplicate code path, it's worth noting that introduces the risk of drift (one path gets updated but not the other).

If it's just a helptext concern, I don't think that's worth a copy/paste. If it's adding additional validation of mapped vs guest collection types; I could buy it. It's a fairly small copy/paste.


I'll include that in a new rev of this PR.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not that concerned about the paths being duplicated, since I think they are actually different. The question IMO is only how much it's worth working hard to avoid code duplication.

I want the following:

  • GCP-specific checks in the GCP command
  • legacy-specific deprecations in the legacy command
  • different helptext for the two

The worry about drift would be more pronounced if this didn't take the form of a deprecation. However, I don't think we want to keep globus endpoint (the whole tree), so we should be making moves to deprecate its various pieces.

Copy link
Member

@sirosen sirosen left a comment

Choose a reason for hiding this comment

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

This is the change I was hoping to see! There's a a docstring typo to fix, and an optional suggestion I shared.

src/globus_cli/commands/endpoint/set_subscription_id.py Outdated Show resolved Hide resolved

def convert(
self, value: str, param: click.Parameter | None, ctx: click.Context | None
) -> t.Any:
Copy link
Member

Choose a reason for hiding this comment

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

It's not super-closely related to this PR, but just because I think it's cool, I wanted to mention that under the latest click-type-test, you can write convert(...) -> uuid.UUID | ExplicitNullType and omit get_type_annotation.

Copy link
Member

Choose a reason for hiding this comment

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

With #923 merged, you could now apply this change here (after a rebase).

src/globus_cli/commands/gcp/set_subscription_id.py Outdated Show resolved Hide resolved
@derek-globus derek-globus merged commit 44eab4c into globus:main Jan 4, 2024
19 checks passed
@derek-globus derek-globus deleted the gcs-subscription-id-sc-28587 branch January 4, 2024 19:38
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