Browse Source

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
changes/11/471611/7
Erik Olof Gunnar Andersson 4 years ago
parent
commit
dae4a1b28c
  1. 2
      .gitreview
  2. 9
      neutron_lbaas_dashboard/api/lbaasv2.py
  3. 2
      neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/__init__.py
  4. 2
      neutron_lbaas_dashboard/dashboards/project/loadbalancersv2/workflows/update_lb.py
  5. 1
      test-requirements.txt

2
.gitreview

@ -1,4 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=openstack/neutron-lbaas-dashboard.git
project=openstack/octavia-dashboard.git

9
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]

2
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

2
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"

1
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

Loading…
Cancel
Save