From afa6e64ad3adc355ea72b78083724ad33f97ccb2 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 28 Nov 2023 21:11:11 -0700 Subject: [PATCH] Handle optional config-file --- .../deploy/deployment_create.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/stack_orchestrator/deploy/deployment_create.py b/stack_orchestrator/deploy/deployment_create.py index 4f3a65ce..88ce0b2a 100644 --- a/stack_orchestrator/deploy/deployment_create.py +++ b/stack_orchestrator/deploy/deployment_create.py @@ -301,15 +301,16 @@ def init_operation(deploy_command_context, stack, deployer_type, config, new_config = config_variables merged_config = {**new_config, **orig_config} spec_file_content.update({"config": merged_config}) - config_file_path = Path(config_file) - if not config_file_path.exists(): - error_exit(f"config file: {config_file} does not exist") - config_file_variables = env_var_map_from_file(config_file_path) - if config_file_variables: - orig_config = spec_file_content.get("config", {}) - new_config = config_file_variables - merged_config = {**new_config, **orig_config} - spec_file_content.update({"config": merged_config}) + if config_file: + config_file_path = Path(config_file) + if not config_file_path.exists(): + error_exit(f"config file: {config_file} does not exist") + config_file_variables = env_var_map_from_file(config_file_path) + if config_file_variables: + orig_config = spec_file_content.get("config", {}) + new_config = config_file_variables + merged_config = {**new_config, **orig_config} + spec_file_content.update({"config": merged_config}) if opts.o.debug: print(f"Creating spec file for stack: {stack} with content: {spec_file_content}")