Merge "Exclude network which don't have subnet"

This commit is contained in:
Jenkins 2015-12-05 16:11:54 +00:00 committed by Gerrit Code Review
commit 1b6807baf3

View File

@ -90,7 +90,7 @@ def network_field_data(request, include_empty_option=False):
if api.base.is_service_enabled(request, 'network'):
try:
networks = api.neutron.network_list_for_tenant(request, tenant_id)
networks = [(n.id, n.name_or_id) for n in networks]
networks = [(n.id, n.name_or_id) for n in networks if n['subnets']]
networks.sort(key=lambda obj: obj[1])
except Exception as e:
msg = _('Failed to get network list {0}').format(six.text_type(e))