Skip to content

Commit

Permalink
ci: auto fixes from pre-commit.ci
Browse files Browse the repository at this point in the history
For more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 19, 2024
1 parent f8d5cf4 commit 7be2547
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/bentoml_cli/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
if t.TYPE_CHECKING:
from .utils import SharedOptions


@click.group(name="cloud", cls=BentoMLCommandGroup)
def cloud_command():
"""BentoCloud Subcommands Groups."""
Expand All @@ -38,13 +39,17 @@ def cloud_command():
"--endpoint",
type=click.STRING,
help="BentoCloud or Yatai endpoint, default as https://cloud.bentoml.com",
default=environ["BENTO_CLOUD_API_ENDPOINT"] if "BENTO_CLOUD_API_ENDPOINT" in environ else "https://cloud.bentoml.com",
default=environ["BENTO_CLOUD_API_ENDPOINT"]
if "BENTO_CLOUD_API_ENDPOINT" in environ
else "https://cloud.bentoml.com",
)
@cog.optgroup.option(
"--api-token",
type=click.STRING,
help="BentoCloud or Yatai user API token",
default=environ["BENTO_CLOUD_API_KEY"] if "BENTO_CLOUD_API_KEY" in environ else None,
default=environ["BENTO_CLOUD_API_KEY"]
if "BENTO_CLOUD_API_KEY" in environ
else None,
)
@click.pass_obj
def login(shared_options: SharedOptions, endpoint: str, api_token: str) -> None: # type: ignore (not accessed)
Expand Down Expand Up @@ -107,9 +112,11 @@ def login(shared_options: SharedOptions, endpoint: str, api_token: str) -> None:
)

add_context(ctx)
click.echo(f"✅ Configured BentoCloud credentials (current-context: {ctx.name})")
click.echo(
f"✅ Configured BentoCloud credentials (current-context: {ctx.name})"
)
click.echo(f"✅ Logged in as {user.email} at {org.name}")
except CloudRESTApiClientError as e:
except CloudRESTApiClientError as e:
if e.error_code == 401:
click.echo(
f"🚨 Error validating token: HTTP 401: Bad credentials ({endpoint}/api-token)"
Expand Down

0 comments on commit 7be2547

Please sign in to comment.