diff --git a/src/_nebari/stages/infrastructure/__init__.py b/src/_nebari/stages/infrastructure/__init__.py index fce5bd60b0..a5894687ac 100644 --- a/src/_nebari/stages/infrastructure/__init__.py +++ b/src/_nebari/stages/infrastructure/__init__.py @@ -618,21 +618,19 @@ def check_provider(cls, data: Any) -> Any: raise ValueError( f"'{provider}' is not a valid enumeration member; permitted: local, existing, aws, gcp, azure" ) - - set_providers = [ - provider - for provider in provider_name_abbreviation_map.keys() - if provider in data and data[provider] - ] - num_providers = len(set_providers) - if num_providers > 1: - raise ValueError( - f"Only a single provider may be set. Multiple providers are set: {set_providers}" - ) - elif num_providers == 1: - data["provider"] = provider_name_abbreviation_map[set_providers[0]] - elif num_providers == 0: - data["provider"] = schema.ProviderEnum.local.value + else: + set_providers = [ + provider + for provider in provider_name_abbreviation_map.keys() + if provider in data + ] + num_providers = len(set_providers) + if num_providers > 1: + raise ValueError(f"Multiple providers set: {set_providers}") + elif num_providers == 1: + data["provider"] = provider_name_abbreviation_map[set_providers[0]] + elif num_providers == 0: + data["provider"] = schema.ProviderEnum.local.value return data