Skip to content

Commit 844541e

Browse files
authored
Merge pull request #161 from victormlg/vagrant_config_error
ENT-13484: Fixed cf-remote erroring when spawn vagrant vm without cloud config
2 parents b099d32 + 482bad2 commit 844541e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

cf_remote/commands.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,6 @@ def spawn(
409409
creds_data = None
410410
if os.path.exists(CLOUD_CONFIG_FPATH):
411411
creds_data = read_json(CLOUD_CONFIG_FPATH)
412-
if not creds_data:
413-
raise CFRUserError("Cloud configuration not found at %s" % CLOUD_CONFIG_FPATH)
414412

415413
vms_info = None
416414
if os.path.exists(CLOUD_STATE_FPATH):
@@ -428,6 +426,10 @@ def spawn(
428426
sec_groups = None
429427
key_pair = None
430428
if provider == Providers.AWS:
429+
if not creds_data:
430+
raise CFRUserError(
431+
"Cloud configuration not found at %s" % CLOUD_CONFIG_FPATH
432+
)
431433
try:
432434
creds = _get_aws_creds_from_env() or AWSCredentials(
433435
creds_data["aws"]["key"],
@@ -442,6 +444,10 @@ def spawn(
442444

443445
region = region or creds_data["aws"].get("region", "eu-west-1")
444446
elif provider == Providers.GCP:
447+
if not creds_data:
448+
raise CFRUserError(
449+
"Cloud configuration not found at %s" % CLOUD_CONFIG_FPATH
450+
)
445451
try:
446452
creds = GCPCredentials(
447453
creds_data["gcp"]["project_id"],

0 commit comments

Comments
 (0)