diff --git a/contrib/extraroute/extraroute/resources/extraroute.py b/contrib/extraroute/extraroute/resources/extraroute.py index c48ff770d8..ef2037e7c8 100644 --- a/contrib/extraroute/extraroute/resources/extraroute.py +++ b/contrib/extraroute/extraroute/resources/extraroute.py @@ -12,6 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. +import six + from heat.common import exception from heat.common.i18n import _ from heat.engine import constraints @@ -48,7 +50,7 @@ class ExtraRoute(neutron.NeutronResource): def add_dependencies(self, deps): super(ExtraRoute, self).add_dependencies(deps) - for resource in self.stack.itervalues(): + for resource in six.itervalues(self.stack): # depend on any RouterInterface in this template with the same # router_id as this router_id if (resource.has_interface('OS::Neutron::RouterInterface') and diff --git a/heat/objects/resource.py b/heat/objects/resource.py index 12bd71fce7..615f08349b 100755 --- a/heat/objects/resource.py +++ b/heat/objects/resource.py @@ -20,6 +20,7 @@ Resource object from oslo_versionedobjects import base from oslo_versionedobjects import fields +import six from heat.db import api as db_api from heat.objects import fields as heat_fields @@ -91,7 +92,7 @@ class Resource( resource_name, cls._from_db_object(cls(context), context, resource_db) ) - for resource_name, resource_db in resources_db.iteritems() + for resource_name, resource_db in six.iteritems(resources_db) ] return dict(resources) @@ -119,7 +120,7 @@ class Resource( resource_name, cls._from_db_object(cls(context), context, resource_db) ) - for resource_name, resource_db in resources_db.iteritems() + for resource_name, resource_db in six.iteritems(resources_db) ] return dict(resources) diff --git a/heat/tests/test_common_serializers.py b/heat/tests/test_common_serializers.py index ebdeac0922..6b7fc0b92c 100644 --- a/heat/tests/test_common_serializers.py +++ b/heat/tests/test_common_serializers.py @@ -47,8 +47,8 @@ class JSONResponseSerializerTest(common.HeatTestCase): response = webob.Response() serializers.JSONResponseSerializer().default(response, fixture) self.assertEqual(200, response.status_int) - content_types = filter(lambda h: h[0] == 'Content-Type', - response.headerlist) + content_types = list(filter(lambda h: h[0] == 'Content-Type', + response.headerlist)) self.assertEqual(1, len(content_types)) self.assertEqual('application/json', response.content_type) self.assertEqual('{"key": "value"}', response.body) @@ -103,8 +103,8 @@ class XMLResponseSerializerTest(common.HeatTestCase): response = webob.Response() serializers.XMLResponseSerializer().default(response, fixture) self.assertEqual(200, response.status_int) - content_types = filter(lambda h: h[0] == 'Content-Type', - response.headerlist) + content_types = list(filter(lambda h: h[0] == 'Content-Type', + response.headerlist)) self.assertEqual(1, len(content_types)) self.assertEqual('application/xml', response.content_type) self.assertEqual('value', response.body)