diff --git a/app/bundles/storage.py b/app/bundles/storage.py index 4dd0616a93cc11a003fd97c7432bca41aa48a699..6b2538d067205b9629ca0ebb879d19f5f09fc19c 100644 --- a/app/bundles/storage.py +++ b/app/bundles/storage.py @@ -55,12 +55,19 @@ def get_storage() -> BundleStorageClient: logger.critical("Error: No CLOUD_PROVIDER ENV VAR SET") sys.exit(1) + allowed_values = ["aws", "gc", "az", "local", "ibm", "baremetal"] + cloud_env = os.environ.get("CLOUD_PROVIDER") - try: - provider_module = _import_provider_specific_module(cloud_env) - except ModuleNotFoundError as exc: - logger.critical(f"Error occurred while importing module for {cloud_env}") - logger.critical(f"Exception: {exc}") + + if cloud_env in allowed_values: + try: + provider_module = _import_provider_specific_module(cloud_env) + except ModuleNotFoundError as exc: + logger.critical(f"Error occurred while importing module for {cloud_env}") + logger.critical(f"Exception: {exc}") + else: + logger.critical("Error: specified CLOUD_PROVIDER wasn't in allowed list") + sys.exit(1) logger.info(f"get_storage provider for cloud_env {cloud_env}") return provider_module.storage_client()