py34: fix iteritems/itervalues using
Change-Id: Id3e3e814448be22184270db57ff43f5f83c4d1c1
This commit is contained in:
parent
ed6814b0c6
commit
f51ca94079
|
@ -126,7 +126,7 @@ def dict_from_dotted_str(items):
|
|||
|
||||
def _render_dict(el, data):
|
||||
try:
|
||||
for key, val in data.iteritems():
|
||||
for key, val in six.iteritems(data):
|
||||
sub_el = etree.SubElement(el, key)
|
||||
_render_data(sub_el, val)
|
||||
except Exception:
|
||||
|
@ -434,7 +434,7 @@ def get_os_image_mappings(os_image_properties):
|
|||
new_bdm = create_virtual_bdm(bdm.get('device_name'),
|
||||
virtual_name)
|
||||
else:
|
||||
new_bdm = {key: val for key, val in bdm.iteritems()
|
||||
new_bdm = {key: val for key, val in six.iteritems(bdm)
|
||||
if key in LEGACY_BDM_FIELDS}
|
||||
if bdm.get('snapshot_id'):
|
||||
new_bdm.update({'source_type': 'snapshot',
|
||||
|
|
|
@ -1049,7 +1049,7 @@ def _get_groups_name_to_id(context):
|
|||
|
||||
|
||||
def _get_ip_info_for_instance(os_instance):
|
||||
addresses = list(itertools.chain(*os_instance.addresses.itervalues()))
|
||||
addresses = list(itertools.chain(*six.itervalues(os_instance.addresses)))
|
||||
fixed_ip = next((addr['addr'] for addr in addresses
|
||||
if (addr['version'] == 4 and
|
||||
addr['OS-EXT-IPS:type'] == 'fixed')), None)
|
||||
|
|
|
@ -17,6 +17,7 @@ import copy
|
|||
|
||||
import netaddr
|
||||
from novaclient import exceptions as nova_exception
|
||||
import six
|
||||
|
||||
from ec2api.api import clients
|
||||
from ec2api.api import common
|
||||
|
@ -594,7 +595,7 @@ def _get_active_route_destinations(context, route_table):
|
|||
if (item['vpc_id'] == route_table['vpc_id'] and
|
||||
(ec2utils.get_ec2_id_kind(item['id']) != 'vgw' or
|
||||
item['id'] in vpn_connections))}
|
||||
for vpn in vpn_connections.itervalues():
|
||||
for vpn in six.itervalues(vpn_connections):
|
||||
if vpn['vpn_gateway_id'] in destinations:
|
||||
destinations[vpn['vpn_gateway_id']]['vpn_connection'] = vpn
|
||||
return destinations
|
||||
|
|
|
@ -19,6 +19,7 @@ from lxml import etree
|
|||
import netaddr
|
||||
from neutronclient.common import exceptions as neutron_exception
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from ec2api.api import clients
|
||||
from ec2api.api import common
|
||||
|
@ -322,7 +323,7 @@ def _format_customer_config(vpn_connection, customer_gateways, os_ikepolicies,
|
|||
|
||||
def _stop_vpn_connection(neutron, vpn_connection):
|
||||
connection_ids = vpn_connection['os_ipsec_site_connections']
|
||||
for os_connection_id in connection_ids.itervalues():
|
||||
for os_connection_id in six.itervalues(connection_ids):
|
||||
try:
|
||||
neutron.delete_ipsec_site_connection(os_connection_id)
|
||||
except neutron_exception.NotFound:
|
||||
|
|
|
@ -61,7 +61,7 @@ class EC2APIException(Exception):
|
|||
# log the issue and the kwargs
|
||||
LOG.exception(_('Exception in string format operation for '
|
||||
'%s exception'), self.__class__.__name__)
|
||||
for name, value in kwargs.iteritems():
|
||||
for name, value in six.iteritems(kwargs):
|
||||
LOG.error('%s: %s' % (name, value))
|
||||
|
||||
if CONF.fatal_exception_format_errors:
|
||||
|
|
|
@ -17,6 +17,7 @@ import itertools
|
|||
|
||||
from novaclient import exceptions as nova_exception
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from ec2api.api import clients
|
||||
from ec2api.api import ec2utils
|
||||
|
@ -79,7 +80,7 @@ def get_os_instance_and_project_id(context, fixed_ip):
|
|||
if any((addr['addr'] == fixed_ip and
|
||||
addr['OS-EXT-IPS:type'] == 'fixed')
|
||||
for addr in itertools.chain(
|
||||
*os_instance.addresses.itervalues())))
|
||||
*six.itervalues(os_instance.addresses))))
|
||||
except (nova_exception.NotFound, StopIteration):
|
||||
raise exception.EC2MetadataNotFound()
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ class BaseRequestHandler(object):
|
|||
elif isinstance(value, datetime.datetime):
|
||||
parts.append(value.strftime("%Y-%m-%dT%H:%M:%S.000Z"))
|
||||
elif isinstance(value, dict):
|
||||
for name, subvalue in value.iteritems():
|
||||
for name, subvalue in six.iteritems(value):
|
||||
if not isinstance(subvalue, list):
|
||||
subvalue = [subvalue]
|
||||
for subsubvalue in subvalue:
|
||||
|
|
|
@ -20,6 +20,7 @@ import re
|
|||
import fixtures
|
||||
from lxml import etree
|
||||
import mock
|
||||
import six
|
||||
|
||||
from ec2api.api import ec2utils
|
||||
|
||||
|
@ -149,7 +150,7 @@ def _safe_copy_parameters(args, kwargs):
|
|||
args = [_safe_copy(arg)
|
||||
for arg in args]
|
||||
kwargs = {key: _safe_copy(val)
|
||||
for key, val in kwargs.iteritems()}
|
||||
for key, val in six.iteritems(kwargs)}
|
||||
return (args, kwargs)
|
||||
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ from oslo_log import log as logging
|
|||
from oslo_utils import excutils
|
||||
from paste import deploy
|
||||
import routes.middleware
|
||||
import six
|
||||
import webob.dec
|
||||
import webob.exc
|
||||
|
||||
|
@ -404,7 +405,7 @@ class Debug(Middleware):
|
|||
resp = req.get_response(self.application)
|
||||
|
||||
print(('*' * 40) + ' RESPONSE HEADERS')
|
||||
for (key, value) in resp.headers.iteritems():
|
||||
for (key, value) in six.iteritems(resp.headers):
|
||||
print(key, '=', value)
|
||||
print()
|
||||
|
||||
|
|
Loading…
Reference in New Issue