From f43f11bb35f7a8290125b8398dff6daee8e38aa4 Mon Sep 17 00:00:00 2001 From: Nicolas Simonds Date: Tue, 24 Sep 2013 13:49:36 -0700 Subject: [PATCH] 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 --- .../project/instances/workflows/create_instance.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py index 1cd83bd65d..db7352d640 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py @@ -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):