Don't insert "Any Availaibility Zone" on single-AZ configurations

In cases where there is one AZ configured, Horizon displays the
option "Any Availability Zone" as the default.  This is confusing,
since there is only one.

Since there is logic to handle the "zero AZs configured" case
already, this is in fact an off-by-one error.  Alter the logic to
also handle the "one AZ configured" case and leave the single valid
option selected.

Fixes bug: 1229935

Change-Id: I49319e9c309c1ed41fd55e9297b0b461d17c726d
This commit is contained in:
Nicolas Simonds 2013-09-24 13:49:36 -07:00
parent e063659d66
commit f43f11bb35

View File

@ -243,10 +243,10 @@ class SetInstanceDetailsAction(workflows.Action):
zone_list = [(zone.zoneName, zone.zoneName)
for zone in zones if zone.zoneState['available']]
zone_list.sort()
if zone_list:
zone_list.insert(0, ("", _("Any Availability Zone")))
else:
if not zone_list:
zone_list.insert(0, ("", _("No availability zones found.")))
elif len(zone_list) > 1:
zone_list.insert(0, ("", _("Any Availability Zone")))
return zone_list
def get_help_text(self):