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

Nebari cli: Add files _init.py and main.py #1423

Merged
merged 2 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion qhub/cli/_init.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import os

import typer
from rich import print

from qhub.schema import ProviderEnum


def check_cloud_provider_creds(cloud_provider: str):

print("[green]Initializing the Nebari 🚀 [/green]")
print(
"\n[green]Note: Values that the user assign for each arguments will be reflected in the [red]config.yaml[/red] file. Later you can update by using[blue] nebari update[/blue] command [/green]"
)

cloud_provider = cloud_provider.lower()

if cloud_provider == ProviderEnum.aws.value and (
not os.environ.get("AWS_ACCESS_KEY_ID")
or not os.environ.get("AWS_SECRET_ACCESS_KEY")
):
print(
"\nUnable to location AWS credentials, please generate your AWS keys at this link: aws.com/..."
"Unable to location AWS credentials, please generate your AWS keys at this link:[blue] https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create.html[/blue]"
)
os.environ["AWS_ACCESS_KEY_ID"] = typer.prompt(
"Please enter your AWS_ACCESS_KEY_ID",
Expand Down
36 changes: 30 additions & 6 deletions qhub/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,54 @@ def init(
None,
"--project-name",
"--project",
"-p",
prompt=True,
),
domain_name: str = typer.Option(
None,
"--domain-name",
"--domain",
"-d",
prompt=True,
),
auth_provider: str = typer.Option(
"password",
prompt=True,
# callback=auth_provider_options
),
namespace: str = typer.Option(
"dev",
prompt=True,
# callback=auth_provider_options
),
repository: str = typer.Option(
None,
prompt=True,
# callback=auth_provider_options
),
ci_provider: str = typer.Option(
"github-actions",
prompt=True,
# callback=auth_provider_options
),
terraform_state: str = typer.Option(
"remote",
prompt=True,
# callback=auth_provider_options
),
kubernetes_version: str = typer.Option(
"latest",
prompt=True,
# callback=auth_provider_options
),
ssl_cert: str = typer.Option(
"email",
prompt=True,
# callback=auth_provider_options
),
):
"""
Initialize the nebari-config.yaml file.

"""
print(f"Cloud provider: {cloud_provider}")
print(f"Project name: {project_name}")
print(f"Domain name: {domain_name}")
print(f"Auth provider: {auth_provider}")


@app.command()
Expand Down