Allow an empty region list

If the AVAILABLE_REGIONS list is empty, treat it the same as if
it wasn't specified at all. This is needed for when we can't
leave out a setting from configuration, in oslo_config.

Change-Id: I97552894e1f9c4312e64ec882ac604bae3b16b55
This commit is contained in:
Radomir Dopieralski 2015-01-14 13:45:39 +01:00
parent d5ba1a2dd9
commit 3e2d978df6
1 changed files with 4 additions and 1 deletions

View File

@ -75,7 +75,10 @@ class Login(django_auth_forms.AuthenticationForm):
@staticmethod
def get_region_choices():
default_region = (settings.OPENSTACK_KEYSTONE_URL, "Default Region")
return getattr(settings, 'AVAILABLE_REGIONS', [default_region])
regions = getattr(settings, 'AVAILABLE_REGIONS', [])
if not regions:
regions = [default_region]
return regions
@sensitive_variables()
def clean(self):