Skip to content

Commit

Permalink
minor prettifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Korovin committed Jul 11, 2021
1 parent 9ffa3dd commit f133a0f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ anyio==3.2.1
argcomplete==1.12.3
asgiref==3.3.4
attrs==21.2.0
boltons==21.0.0
boto3==1.17.95
botocore==1.20.95
certifi==2021.5.30
Expand All @@ -17,6 +18,7 @@ durationpy==0.5
Faker==8.9.1
fastapi==0.65.2
Flask==2.0.1
furl==2.1.2
future==0.18.2
googleapis-common-protos==1.53.0
grpcio==1.38.1
Expand All @@ -31,6 +33,7 @@ Jinja2==3.0.1
jmespath==0.10.0
kappa==0.6.0
MarkupSafe==2.0.1
orderedmultidict==1.0.1
packaging==20.9
pep517==0.10.0
pip-tools==6.2.0
Expand Down Expand Up @@ -63,7 +66,4 @@ urllib3==1.26.5
Werkzeug==2.0.1
wsgi-request-logger==0.4.6
yandexcloud==0.92.0
-e git+https://github.com/e-kor/yappa.git@7aaaf4c4fb8e17fde4ec3d51663c69cbb8856e42#egg=yappa

boltons~=21.0.0
setuptools~=57.0.0
-e git+https://github.com/e-kor/yappa.git@9ffa3dd45ce7a83508c3c5c63a4169a71e622d20#egg=yappa
1 change: 1 addition & 0 deletions yappa/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def setup(config_file, token):
*you can skip this step if YC_OAUTH and YC_FOLDER in env vars
(see README for authentication details)
"""
click.echo("Welcome to " + click.style("Yappa", fg="yellow") + "!")
if not token:
click.echo(f"Please obtain OAuth token at "
+ click.style(YANDEX_OAUTH_URL, fg="yellow"))
Expand Down
17 changes: 10 additions & 7 deletions yappa/cli_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def create_gateway(yc, config, function_id):
gw_config = inject_function_id(gw_config, f"{function_id}", config[
"project_slug"])
save_yaml(gw_config, gw_config_filename)
click.echo("saved Yappa Gateway config file at "
click.echo("Saved Yappa Gateway config file at "
+ click.style(gw_config_filename, bold=True))
click.echo("Ensuring api-gateway...")
gateway, is_new = yc.create_gateway(config["project_slug"],
Expand All @@ -87,21 +87,24 @@ def create_gateway(yc, config, function_id):
"\tid: " +
click.style(
f"{gateway.id}", ) + "\n"
+ "\tdefault domain : " + click.style(f"{gateway.domain}",
+ "\tdomain : " + click.style(f"{gateway.domain}",
fg="yellow"))
return is_new


def update_gateway(yc, config):
gateway = yc.get_gateway(config["project_slug"])
click.echo(f"Updating api-gateway "
+ click.style(f"{gateway.name}", bold=True)
+ f" (id: {gateway.id})")
+ click.style(f"{gateway.name}", bold=True))
yc.update_gateway(gateway.name, config["description"],
load_yaml(config["gw_config"]))
click.echo(f"Updated api-gateway. Default domain: "
+ click.style(f"{gateway.domain}", fg="yellow"))

click.echo("Updated api-gateway:\n"
"\tname: " + click.style(f"{gateway.name}") + "\n"
"\tid: " +
click.style(
f"{gateway.id}", ) + "\n"
+ "\tdomain : " + click.style(f"{gateway.domain}",
fg="yellow"))

class ValidationError(ClickException):
pass
Expand Down
3 changes: 2 additions & 1 deletion yappa/yc/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def create_service_account(self,
"""
for account in self._get_service_accounts():
if account.name == service_account_name:
logger.warning("Account %s already exists, skipping creation")
logger.warning("Account %s already exists, skipping creation",
service_account_name)
return account
account = self.sdk.wait_operation_and_get_result(
self.sdk.client(ServiceAccountServiceStub).Create(
Expand Down
1 change: 0 additions & 1 deletion yappa/yc/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def _get_gateways(self, filter_=None) -> Iterable[ApiGateway]:

def create_gateway(self, name, openapi_spec,
description="") -> ApiGateway:
print(f"NAME IS {name}")
with suppress(ValueError):
gateway = self.get_gateway(name)
return gateway, False
Expand Down

0 comments on commit f133a0f

Please sign in to comment.