Merge "Remove six and python 2.7 full support"
This commit is contained in:
commit
058e6bcffd
@ -12,7 +12,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import six
|
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from heat.common import context
|
from heat.common import context
|
||||||
@ -40,7 +39,7 @@ class TemplateFiles(collections.Mapping):
|
|||||||
self.files_id = files.files_id
|
self.files_id = files.files_id
|
||||||
self.files = files.files
|
self.files = files.files
|
||||||
return
|
return
|
||||||
if isinstance(files, six.integer_types):
|
if isinstance(files, int):
|
||||||
self.files_id = files
|
self.files_id = files
|
||||||
if self.files_id in _d:
|
if self.files_id in _d:
|
||||||
self.files = _d[self.files_id]
|
self.files = _d[self.files_id]
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import six
|
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
@ -354,6 +353,6 @@ def resolve_and_find(value, cplugin, finder, entity=None,
|
|||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if ignore_resolve_error:
|
if ignore_resolve_error:
|
||||||
LOG.info("Ignoring error in RESOLVE translation: %s",
|
LOG.info("Ignoring error in RESOLVE translation: %s",
|
||||||
six.text_type(ex))
|
str(ex))
|
||||||
return value
|
return value
|
||||||
raise
|
raise
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
import six
|
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.engine import dependencies
|
from heat.engine import dependencies
|
||||||
@ -145,7 +144,7 @@ class StackUpdate(object):
|
|||||||
failure = exception.ResourceFailure(ex, existing_res,
|
failure = exception.ResourceFailure(ex, existing_res,
|
||||||
existing_res.UPDATE)
|
existing_res.UPDATE)
|
||||||
existing_res._add_event(existing_res.UPDATE, existing_res.FAILED,
|
existing_res._add_event(existing_res.UPDATE, existing_res.FAILED,
|
||||||
six.text_type(ex))
|
str(ex))
|
||||||
raise failure
|
raise failure
|
||||||
|
|
||||||
def _update_resource_data(self, resource):
|
def _update_resource_data(self, resource):
|
||||||
@ -255,7 +254,7 @@ class StackUpdate(object):
|
|||||||
for e in existing_deps.graph(reverse=True).edges():
|
for e in existing_deps.graph(reverse=True).edges():
|
||||||
yield e
|
yield e
|
||||||
# Don't cleanup old resources until after they have been replaced
|
# Don't cleanup old resources until after they have been replaced
|
||||||
for name, res in six.iteritems(self.existing_stack):
|
for name, res in self.existing_stack.items():
|
||||||
if name in self.new_stack:
|
if name in self.new_stack:
|
||||||
yield (res, self.new_stack[name])
|
yield (res, self.new_stack[name])
|
||||||
|
|
||||||
|
@ -15,12 +15,11 @@
|
|||||||
|
|
||||||
from oslo_serialization import jsonutils as json
|
from oslo_serialization import jsonutils as json
|
||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
class Json(fields.FieldType):
|
class Json(fields.FieldType):
|
||||||
def coerce(self, obj, attr, value):
|
def coerce(self, obj, attr, value):
|
||||||
if isinstance(value, six.string_types):
|
if isinstance(value, str):
|
||||||
loaded = json.loads(value)
|
loaded = json.loads(value)
|
||||||
return loaded
|
return loaded
|
||||||
return value
|
return value
|
||||||
|
@ -21,7 +21,6 @@ from oslo_config import cfg
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_versionedobjects import base
|
from oslo_versionedobjects import base
|
||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import six
|
|
||||||
import tenacity
|
import tenacity
|
||||||
|
|
||||||
from heat.common import crypt
|
from heat.common import crypt
|
||||||
@ -57,7 +56,7 @@ class ResourceCache(object):
|
|||||||
self.by_stack_id_name = collections.defaultdict(dict)
|
self.by_stack_id_name = collections.defaultdict(dict)
|
||||||
|
|
||||||
def set_by_stack_id(self, resources):
|
def set_by_stack_id(self, resources):
|
||||||
for res in six.itervalues(resources):
|
for res in resources.values():
|
||||||
self.by_stack_id_name[res.stack_id][res.name] = res
|
self.by_stack_id_name[res.stack_id][res.name] = res
|
||||||
|
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ class Resource(
|
|||||||
resource_name,
|
resource_name,
|
||||||
cls._from_db_object(cls(context), context, resource_db)
|
cls._from_db_object(cls(context), context, resource_db)
|
||||||
)
|
)
|
||||||
for resource_name, resource_db in six.iteritems(resources_db)
|
for resource_name, resource_db in resources_db.items()
|
||||||
]
|
]
|
||||||
return dict(resources)
|
return dict(resources)
|
||||||
|
|
||||||
@ -246,7 +245,7 @@ class Resource(
|
|||||||
resource_name,
|
resource_name,
|
||||||
cls._from_db_object(cls(context), context, resource_db)
|
cls._from_db_object(cls(context), context, resource_db)
|
||||||
)
|
)
|
||||||
for resource_name, resource_db in six.iteritems(resources_db)
|
for resource_name, resource_db in resources_db.items()
|
||||||
]
|
]
|
||||||
return dict(resources)
|
return dict(resources)
|
||||||
|
|
||||||
@ -259,7 +258,7 @@ class Resource(
|
|||||||
resource_id,
|
resource_id,
|
||||||
cls._from_db_object(cls(context), context, resource_db)
|
cls._from_db_object(cls(context), context, resource_db)
|
||||||
)
|
)
|
||||||
for resource_id, resource_db in six.iteritems(resources_db)
|
for resource_id, resource_db in resources_db.items()
|
||||||
]
|
]
|
||||||
return dict(resources)
|
return dict(resources)
|
||||||
|
|
||||||
@ -280,7 +279,7 @@ class Resource(
|
|||||||
context,
|
context,
|
||||||
stack_id,
|
stack_id,
|
||||||
stack_id_only=True)
|
stack_id_only=True)
|
||||||
return {db_res.stack_id for db_res in six.itervalues(resources_db)}
|
return {db_res.stack_id for db_res in resources_db.values()}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def purge_deleted(cls, context, stack_id):
|
def purge_deleted(cls, context, stack_id):
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_versionedobjects import base
|
from oslo_versionedobjects import base
|
||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import six
|
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
@ -117,7 +116,7 @@ class Stack(
|
|||||||
def get_by_name_and_owner_id(cls, context, stack_name, owner_id):
|
def get_by_name_and_owner_id(cls, context, stack_name, owner_id):
|
||||||
db_stack = db_api.stack_get_by_name_and_owner_id(
|
db_stack = db_api.stack_get_by_name_and_owner_id(
|
||||||
context,
|
context,
|
||||||
six.text_type(stack_name),
|
str(stack_name),
|
||||||
owner_id
|
owner_id
|
||||||
)
|
)
|
||||||
if not db_stack:
|
if not db_stack:
|
||||||
@ -127,7 +126,7 @@ class Stack(
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_by_name(cls, context, stack_name):
|
def get_by_name(cls, context, stack_name):
|
||||||
db_stack = db_api.stack_get_by_name(context, six.text_type(stack_name))
|
db_stack = db_api.stack_get_by_name(context, str(stack_name))
|
||||||
if not db_stack:
|
if not db_stack:
|
||||||
return None
|
return None
|
||||||
stack = cls._from_db_object(context, cls(context), db_stack)
|
stack = cls._from_db_object(context, cls(context), db_stack)
|
||||||
|
@ -18,7 +18,6 @@ from heat.common.i18n import _
|
|||||||
from heat.engine import resource
|
from heat.engine import resource
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
import six
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -48,19 +47,19 @@ class CooldownMixin(object):
|
|||||||
# Note: this is for supporting old version cooldown checking
|
# Note: this is for supporting old version cooldown checking
|
||||||
metadata.pop('scaling_in_progress', None)
|
metadata.pop('scaling_in_progress', None)
|
||||||
if metadata and cooldown != 0:
|
if metadata and cooldown != 0:
|
||||||
last_adjust = next(six.iterkeys(metadata))
|
last_adjust = next(iter(metadata.keys()))
|
||||||
if not timeutils.is_older_than(last_adjust, cooldown):
|
if not timeutils.is_older_than(last_adjust, cooldown):
|
||||||
self._log_and_raise_no_action(cooldown)
|
self._log_and_raise_no_action(cooldown)
|
||||||
|
|
||||||
elif 'cooldown_end' in metadata:
|
elif 'cooldown_end' in metadata:
|
||||||
cooldown_end = next(six.iterkeys(metadata['cooldown_end']))
|
cooldown_end = next(iter(metadata['cooldown_end'].keys()))
|
||||||
now = timeutils.utcnow().isoformat()
|
now = timeutils.utcnow().isoformat()
|
||||||
if now < cooldown_end:
|
if now < cooldown_end:
|
||||||
self._log_and_raise_no_action(cooldown)
|
self._log_and_raise_no_action(cooldown)
|
||||||
|
|
||||||
elif cooldown != 0:
|
elif cooldown != 0:
|
||||||
# Note: this is also for supporting old version cooldown checking
|
# Note: this is also for supporting old version cooldown checking
|
||||||
last_adjust = next(six.iterkeys(metadata['cooldown']))
|
last_adjust = next(iter(metadata['cooldown'].keys()))
|
||||||
if not timeutils.is_older_than(last_adjust, cooldown):
|
if not timeutils.is_older_than(last_adjust, cooldown):
|
||||||
self._log_and_raise_no_action(cooldown)
|
self._log_and_raise_no_action(cooldown)
|
||||||
|
|
||||||
@ -91,7 +90,7 @@ class CooldownMixin(object):
|
|||||||
seconds=cooldown)).isoformat()
|
seconds=cooldown)).isoformat()
|
||||||
if 'cooldown_end' in metadata:
|
if 'cooldown_end' in metadata:
|
||||||
cooldown_end = max(
|
cooldown_end = max(
|
||||||
next(six.iterkeys(metadata['cooldown_end'])),
|
next(iter(metadata['cooldown_end'].keys())),
|
||||||
cooldown_end)
|
cooldown_end)
|
||||||
metadata['cooldown_end'] = {cooldown_end: cooldown_reason}
|
metadata['cooldown_end'] = {cooldown_end: cooldown_reason}
|
||||||
metadata['scaling_in_progress'] = False
|
metadata['scaling_in_progress'] = False
|
||||||
|
@ -18,7 +18,6 @@ import mock
|
|||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import requests
|
import requests
|
||||||
import six
|
|
||||||
|
|
||||||
from heat.api.aws import ec2token
|
from heat.api.aws import ec2token
|
||||||
from heat.api.aws import exception
|
from heat.api.aws import exception
|
||||||
@ -520,7 +519,7 @@ class Ec2TokenTest(common.HeatTestCase):
|
|||||||
|
|
||||||
ex = self.assertRaises(exception.HeatInternalFailureError,
|
ex = self.assertRaises(exception.HeatInternalFailureError,
|
||||||
ec2.__call__, dummy_req)
|
ec2.__call__, dummy_req)
|
||||||
self.assertEqual('Service misconfigured', six.text_type(ex))
|
self.assertEqual('Service misconfigured', str(ex))
|
||||||
|
|
||||||
def test_call_ok_auth_uri_ec2authtoken(self):
|
def test_call_ok_auth_uri_ec2authtoken(self):
|
||||||
dummy_url = 'http://123:5000/v2.0'
|
dummy_url = 'http://123:5000/v2.0'
|
||||||
|
@ -16,7 +16,6 @@ import os
|
|||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo_config import fixture as config_fixture
|
from oslo_config import fixture as config_fixture
|
||||||
import six
|
|
||||||
|
|
||||||
from heat.api.aws import exception
|
from heat.api.aws import exception
|
||||||
import heat.api.cfn.v1.stacks as stacks
|
import heat.api.cfn.v1.stacks as stacks
|
||||||
@ -1210,7 +1209,7 @@ class CfnStackControllerTest(common.HeatTestCase):
|
|||||||
expected = {'DescribeStackEventsResponse':
|
expected = {'DescribeStackEventsResponse':
|
||||||
{'DescribeStackEventsResult':
|
{'DescribeStackEventsResult':
|
||||||
{'StackEvents':
|
{'StackEvents':
|
||||||
[{'EventId': six.text_type(event_id),
|
[{'EventId': str(event_id),
|
||||||
'StackId': u'arn:openstack:heat::t:stacks/wordpress/6',
|
'StackId': u'arn:openstack:heat::t:stacks/wordpress/6',
|
||||||
'ResourceStatus': u'TEST_IN_PROGRESS',
|
'ResourceStatus': u'TEST_IN_PROGRESS',
|
||||||
'ResourceType': u'AWS::EC2::Instance',
|
'ResourceType': u'AWS::EC2::Instance',
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
import six
|
|
||||||
import webob.exc
|
import webob.exc
|
||||||
|
|
||||||
import heat.api.middleware.fault as fault
|
import heat.api.middleware.fault as fault
|
||||||
@ -221,7 +220,7 @@ class ActionControllerTest(tools.ControllerTest, common.HeatTestCase):
|
|||||||
stack_id=stack_identity.stack_id,
|
stack_id=stack_identity.stack_id,
|
||||||
body=body)
|
body=body)
|
||||||
self.assertEqual(403, resp.status_int)
|
self.assertEqual(403, resp.status_int)
|
||||||
self.assertIn('403 Forbidden', six.text_type(resp))
|
self.assertIn('403 Forbidden', str(resp))
|
||||||
|
|
||||||
def test_action_badaction_ise(self, mock_enforce):
|
def test_action_badaction_ise(self, mock_enforce):
|
||||||
stack_identity = identifier.HeatIdentifier(self.tenant,
|
stack_identity = identifier.HeatIdentifier(self.tenant,
|
||||||
|
Loading…
Reference in New Issue
Block a user