Skip to content
Merged
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
10 changes: 8 additions & 2 deletions cf_remote/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,6 @@ def spawn(
creds_data = None
if os.path.exists(CLOUD_CONFIG_FPATH):
creds_data = read_json(CLOUD_CONFIG_FPATH)
if not creds_data:
raise CFRUserError("Cloud configuration not found at %s" % CLOUD_CONFIG_FPATH)

vms_info = None
if os.path.exists(CLOUD_STATE_FPATH):
Expand All @@ -428,6 +426,10 @@ def spawn(
sec_groups = None
key_pair = None
if provider == Providers.AWS:
if not creds_data:
raise CFRUserError(
"Cloud configuration not found at %s" % CLOUD_CONFIG_FPATH
)
try:
creds = _get_aws_creds_from_env() or AWSCredentials(
creds_data["aws"]["key"],
Expand All @@ -442,6 +444,10 @@ def spawn(

region = region or creds_data["aws"].get("region", "eu-west-1")
elif provider == Providers.GCP:
if not creds_data:
raise CFRUserError(
"Cloud configuration not found at %s" % CLOUD_CONFIG_FPATH
)
try:
creds = GCPCredentials(
creds_data["gcp"]["project_id"],
Expand Down