From 288dc3b26379bee7d3fcd63e81dcff667b7b486a Mon Sep 17 00:00:00 2001 From: Anton Zabreyko Date: Sat, 16 Apr 2022 10:48:36 +0000 Subject: [PATCH] Added GCP re-init condition if GCP config is missing. --- skylark/cli/cli_helper.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/skylark/cli/cli_helper.py b/skylark/cli/cli_helper.py index 892457376..d46cab13b 100644 --- a/skylark/cli/cli_helper.py +++ b/skylark/cli/cli_helper.py @@ -16,6 +16,7 @@ import boto3 import typer from skylark import GB, MB +from skylark import gcp_config_path from skylark.compute.aws.aws_auth import AWSAuthentication from skylark.compute.azure.azure_auth import AzureAuthentication from skylark.compute.gcp.gcp_auth import GCPAuthentication @@ -397,6 +398,10 @@ def load_gcp_config(config: SkylarkConfig, force_init: bool = False) -> SkylarkC typer.secho(" GCP credentials will be re-initialized", fg="red") config.gcp_project_id = None + if not Path(gcp_config_path).is_file(): + typer.secho(" GCP region config missing! GCP will be reconfigured.", fg="red") + config.gcp_project_id = None + if config.gcp_project_id is not None: typer.secho(" GCP already configured! To reconfigure GCP, run `skylark init --reinit-gcp`.", fg="blue") config.gcp_enabled = True