Skip to content

Commit

Permalink
Merge pull request #909 from sirosen/deprecate-v4-cmds
Browse files Browse the repository at this point in the history
Deprecate and hide commands which only apply to GCSv4
  • Loading branch information
sirosen authored Dec 8, 2023
2 parents 3ee3507 + 916670f commit 82785e3
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 96 deletions.
8 changes: 8 additions & 0 deletions changelog.d/20231207_180145_sirosen_deprecate_v4_cmds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Other

* Deprecate and hide commands related to management of GCSv4:

* `globus endpoint activate`
* `globus endpoint deactivate`
* `globus endpoint is-activated`
* `globus endpoint server`
29 changes: 1 addition & 28 deletions src/globus_cli/commands/endpoint/activate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,7 @@
from globus_cli.termio import TextMode, display


@command(
"activate",
short_help="Activate an endpoint",
adoc_examples="""Activate an endpoint using just Automatic activation:
[source,bash]
----
$ ep_id=aa752cea-8222-5bc8-acd9-555b090c0ccb
$ globus endpoint activate $ep_id
----
Activate an endpoint using Web activation
[source,bash]
----
$ ep_id=aa752cea-8222-5bc8-acd9-555b090c0ccb
$ globus endpoint activate $ep_id --web
----
Activate an endpoint using Myproxy activation, skipping the username prompt.
[source,bash]
----
$ ep_id=aa752cea-8222-5bc8-acd9-555b090c0ccb
$ globus endpoint activate $ep_id --myproxy -U username
----
""",
)
@command("activate", deprecated=True, hidden=True)
@endpoint_id_arg
@click.option(
"--web",
Expand Down
3 changes: 1 addition & 2 deletions src/globus_cli/commands/endpoint/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
GCP_FIELDS = [Field("Setup Key", "globus_connect_setup_key")]


@command("create", hidden=True)
@command("create", deprecated=True, hidden=True)
@endpointish_params.create(
name="endpoint",
keyword_style="string",
Expand Down Expand Up @@ -117,7 +117,6 @@ def endpoint_create(

print_command_hint(
"""\
WARNING: This command is deprecated!
For GCP, use one of the following replacements instead:
globus gcp create mapped
Expand Down
13 changes: 1 addition & 12 deletions src/globus_cli/commands/endpoint/deactivate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,7 @@
from globus_cli.termio import TextMode, display


@command(
"deactivate",
short_help="Deactivate an endpoint",
adoc_examples="""Deactivate an endpoint:
[source,bash]
----
$ ep_id=aa752cea-8222-5bc8-acd9-555b090c0ccb
$ globus endpoint deactivate $ep_id
----
""",
)
@command("deactivate", deprecated=True, hidden=True)
@endpoint_id_arg
@LoginManager.requires_login("transfer")
def endpoint_deactivate(login_manager: LoginManager, *, endpoint_id: uuid.UUID) -> None:
Expand Down
53 changes: 1 addition & 52 deletions src/globus_cli/commands/endpoint/is_activated.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,7 @@
from globus_cli.termio import display


@command(
"is-activated",
short_help="Check if an endpoint is activated",
adoc_exit_status="""0 if the endpoint is activated.
1 if the endpoint is not activated, unless --map-http-status has been
used to change exit behavior on http error codes.
2 if the command was used improperly.
""",
adoc_examples=r"""[source,bash]
----
$ ep_id=aa752cea-8222-5bc8-acd9-555b090c0ccb
$ globus endpoint is-activated $ep_id
----
Check *globus endpoint is-activated* as part of a script:
[source,bash]
----
ep_id=aa752cea-8222-5bc8-acd9-555b090c0ccb
globus endpoint is-activated $ep_id
if [ $? -ne 0 ]; then
echo "$ep_id is not activated! This script cannot run!"
exit 1
fi
# ... more stuff using $ep_id below ...
----
Use `is-activated` to get and parse activation requirements, finding out the
expiration time, but only for endpoints which are activated. Uses '--jmespath'
to select fields, exit status to indicate that the endpoint is or is not
activated, and '--format=UNIX' to get nice, unix-friendly output.
[source,bash]
----
ep_id=aa752cea-8222-5bc8-acd9-555b090c0ccb
output="$(globus endpoint is-activated "$ep_id" \
--jmespath expires_in --format unix)"
if [ $? -eq 0 ]; then
if [ "$output" -eq "-1" ]; then
echo "$ep_id is activated forever. Activation never expires."
else
echo "$ep_id activation expires in $output seconds"
fi
else
echo "$ep_id not activated"
exit 1
fi
----
""",
)
@command("is-activated", deprecated=True, hidden=True)
@endpoint_id_arg
@click.option(
"--until",
Expand Down
2 changes: 2 additions & 0 deletions src/globus_cli/commands/endpoint/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

@group(
"server",
deprecated=True,
hidden=True,
short_help="Manage servers for a Globus endpoint",
lazy_subcommands={
"add": (".add", "server_add"),
Expand Down
1 change: 1 addition & 0 deletions src/globus_cli/commands/endpoint/server/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

@command(
"add",
deprecated=True,
short_help="Add a server to an endpoint",
adoc_examples="""Add a server with a url of gridftp.example.org to an endpoint
Expand Down
1 change: 1 addition & 0 deletions src/globus_cli/commands/endpoint/server/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def _detect_mode(server: str) -> Literal["id", "uri", "hostname", "hostname_port

@command(
"delete",
deprecated=True,
short_help="Delete a server belonging to an endpoint",
adoc_examples="""[source,bash]
----
Expand Down
1 change: 1 addition & 0 deletions src/globus_cli/commands/endpoint/server/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def parse(self, value: t.Any) -> str:

@command(
"list",
deprecated=True,
short_help="List all servers for an endpoint",
adoc_examples="""[source,bash]
----
Expand Down
1 change: 1 addition & 0 deletions src/globus_cli/commands/endpoint/server/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def render(self, value: tuple[PORT_RANGE_T, PORT_RANGE_T]) -> str:

@command(
"show",
deprecated=True,
short_help="Show an endpoint server",
adoc_examples="""[source,bash]
----
Expand Down
1 change: 1 addition & 0 deletions src/globus_cli/commands/endpoint/server/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

@command(
"update",
deprecated=True,
short_help="Update an endpoint server",
adoc_examples="""Change an existing server's scheme to use ftp:
Expand Down
13 changes: 11 additions & 2 deletions tests/functional/test_list_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ def test_list_commands_contains_expected_commands(run_line):
"globus api auth",
"globus bookmark create",
"globus collection delete",
"globus endpoint activate",
"globus endpoint permission create",
"globus endpoint role create",
"globus endpoint server add",
"globus endpoint storage-gateway list",
"globus endpoint user-credential delete",
"globus flows delete",
Expand All @@ -41,3 +39,14 @@ def test_list_commands_contains_expected_commands(run_line):
"globus timer list",
):
assert cmd in result.output

# and does not contain hidden commands
for cmd in (
"globus endpoint create",
"globus endpoint activate",
"globus endpoint deactivate",
"globus endpoint is-activated",
"globus endpoint server",
"globus endpoint server add",
):
assert cmd not in result.output

0 comments on commit 82785e3

Please sign in to comment.