From dae4a1b28ce1fc99f694a3cfdf996ab66b78b313 Mon Sep 17 00:00:00 2001 From: Erik Olof Gunnar Andersson Date: Wed, 7 Jun 2017 00:38:03 -0700 Subject: [PATCH] Replace SortedDict with OrderedDict and fixing Python 3.5 test Starting with Django 1.9 SortedDict has been removed completely, and this is currently blocking the gate. This patch replaces SortedDict with the python native OrderedDict. Depends-On: Iebca15ae962a1aa0825c6ba6d482206531726696 Change-Id: Ia7955ac9b9e549a88839487130c416036bb27c1a --- .gitreview | 2 +- neutron_lbaas_dashboard/api/lbaasv2.py | 9 +++++---- .../project/loadbalancersv2/workflows/__init__.py | 2 +- .../project/loadbalancersv2/workflows/update_lb.py | 2 +- test-requirements.txt | 1 - 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitreview b/.gitreview index b4a76ad6..3ac60969 100644 --- a/.gitreview +++ b/.gitreview @@ -1,4 +1,4 @@ [gerrit] host=review.openstack.org port=29418 -project=openstack/neutron-lbaas-dashboard.git +project=openstack/octavia-dashboard.git diff --git a/neutron_lbaas_dashboard/api/lbaasv2.py b/neutron_lbaas_dashboard/api/lbaasv2.py index ea330dcf..3205c10c 100644 --- a/neutron_lbaas_dashboard/api/lbaasv2.py +++ b/neutron_lbaas_dashboard/api/lbaasv2.py @@ -14,7 +14,8 @@ from __future__ import absolute_import -from django.utils.datastructures import SortedDict +import collections + from django.utils.translation import ugettext_lazy as _ from horizon import messages @@ -473,13 +474,13 @@ def _pool_list(request, expand_subnet=False, expand_vip=False, **kwargs): pools = neutronclient(request).list_pools(**kwargs).get('pools') if expand_subnet: subnets = neutron.subnet_list(request) - subnet_dict = SortedDict((s.id, s) for s in subnets) + subnet_dict = collections.OrderedDict((s.id, s) for s in subnets) for p in pools: subnet = subnet_dict.get(p['subnet_id']) p['subnet_name'] = subnet.cidr if subnet else None if expand_vip: vips = vip_list(request) - vip_dict = SortedDict((v.id, v) for v in vips) + vip_dict = collections.OrderedDict((v.id, v) for v in vips) for p in pools: p['vip_name'] = _get_vip(request, p, vip_dict, expand_name_only=True) @@ -629,7 +630,7 @@ def _member_list(request, expand_pool, **kwargs): members = neutronclient(request).list_members(**kwargs).get('members') if expand_pool: pools = _pool_list(request) - pool_dict = SortedDict((p.id, p) for p in pools) + pool_dict = collections.OrderedDict((p.id, p) for p in pools) for m in members: m['pool_name'] = pool_dict.get(m['pool_id']).name_or_id return [Member(m) for m in members] diff --git a/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/__init__.py b/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/__init__.py index 7c50756d..3dab8ed0 100644 --- a/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/__init__.py +++ b/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/__init__.py @@ -13,4 +13,4 @@ # under the License. from . create_lb import * # noqa -from update_lb import * # noqa +from . update_lb import * # noqa diff --git a/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/update_lb.py b/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/update_lb.py index 6d88e4a2..6cfdf64e 100644 --- a/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/update_lb.py +++ b/neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/update_lb.py @@ -14,7 +14,7 @@ from django.utils.translation import ugettext as _ from neutron_lbaas_dashboard import api -from create_lb import * # noqa +from . create_lb import * # noqa INDEX_URL = "horizon:projects:loadbalancersv2:index" diff --git a/test-requirements.txt b/test-requirements.txt index b08e44ba..ac9ff48b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,6 @@ # process, which may cause wedges in the gate later. hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 - http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon coverage>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT