Merge "Remove six and python 2.7 full support"
This commit is contained in:
commit
e08ac1d8d2
|
@ -10,7 +10,6 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -122,7 +121,7 @@ class DesignateZone(resource.Resource):
|
|||
raise_invalid_exception(self.SECONDARY, self.MASTERS)
|
||||
|
||||
def handle_create(self):
|
||||
args = dict((k, v) for k, v in six.iteritems(self.properties) if v)
|
||||
args = dict((k, v) for k, v in self.properties.items() if v)
|
||||
args['type_'] = args.pop(self.TYPE)
|
||||
|
||||
zone = self.client().zones.create(**args)
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from heat.common import exception
|
||||
|
@ -212,7 +210,7 @@ class AutoScalingResourceGroup(aws_asg.AutoScalingGroup):
|
|||
return resource.Resource.get_reference_id(self)
|
||||
|
||||
def _attribute_output_name(self, *attr_path):
|
||||
return ', '.join(six.text_type(a) for a in attr_path)
|
||||
return ', '.join(str(a) for a in attr_path)
|
||||
|
||||
def get_attribute(self, key, *path): # noqa: C901
|
||||
if key == self.CURRENT_SIZE:
|
||||
|
@ -284,7 +282,7 @@ class AutoScalingResourceGroup(aws_asg.AutoScalingGroup):
|
|||
|
||||
def _nested_output_defns(self, resource_names, get_attr_fn, get_res_fn):
|
||||
for attr in self.referenced_attrs():
|
||||
if isinstance(attr, six.string_types):
|
||||
if isinstance(attr, str):
|
||||
key, path = attr, []
|
||||
else:
|
||||
key, path = attr[0], list(attr[1:])
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
import functools
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
@ -460,7 +459,7 @@ class InstanceGroup(stack_resource.StackResource):
|
|||
|
||||
def _nested_output_defns(self, resource_names, get_attr_fn, get_res_fn):
|
||||
for attr in self.referenced_attrs():
|
||||
if isinstance(attr, six.string_types):
|
||||
if isinstance(attr, str):
|
||||
key = attr
|
||||
else:
|
||||
key = attr[0]
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
import uuid
|
||||
|
||||
from heat.engine import properties
|
||||
|
@ -47,7 +46,7 @@ class NoneResource(resource.Resource):
|
|||
self.translate_properties(self.properties, client_resolve)
|
||||
|
||||
def handle_create(self):
|
||||
self.resource_id_set(six.text_type(uuid.uuid4()))
|
||||
self.resource_id_set(str(uuid.uuid4()))
|
||||
# set is_placeholder flag when resource trying to replace original
|
||||
# resource with a placeholder resource.
|
||||
self.data_set(self.IS_PLACEHOLDER, 'True')
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# 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.common import password_gen
|
||||
|
@ -235,7 +233,7 @@ class RandomString(resource.Resource):
|
|||
if self.resource_id is not None:
|
||||
return self.data().get('value')
|
||||
else:
|
||||
return six.text_type(self.name)
|
||||
return str(self.name)
|
||||
|
||||
|
||||
def resource_mapping():
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
import tempfile
|
||||
|
||||
from heat.common import auth_plugin
|
||||
|
@ -49,7 +48,7 @@ class TempCACertFile(object):
|
|||
try:
|
||||
self._cacert_temp_file = tempfile.NamedTemporaryFile()
|
||||
self._cacert_temp_file.write(
|
||||
six.text_type(self._cacert).encode('utf-8'))
|
||||
str(self._cacert).encode('utf-8'))
|
||||
# Add seek func to make sure the writen context will flush to
|
||||
# tempfile with python 2.7. we can use flush() for python 2.7
|
||||
# but not 3.5.
|
||||
|
@ -266,7 +265,7 @@ class RemoteStack(resource.Resource):
|
|||
location = "remote cloud"
|
||||
else:
|
||||
location = 'region "%s"' % self._region_name
|
||||
exc_info = dict(location=location, exc=six.text_type(ex))
|
||||
exc_info = dict(location=location, exc=str(ex))
|
||||
msg = _('Cannot establish connection to Heat endpoint at '
|
||||
'%(location)s due to "%(exc)s"') % exc_info
|
||||
raise exception.StackValidationFailed(message=msg)
|
||||
|
@ -287,7 +286,7 @@ class RemoteStack(resource.Resource):
|
|||
location = "remote cloud"
|
||||
else:
|
||||
location = 'region "%s"' % self._region_name
|
||||
exc_info = dict(location=location, exc=six.text_type(ex))
|
||||
exc_info = dict(location=location, exc=str(ex))
|
||||
msg = _('Failed validating stack template using Heat endpoint at '
|
||||
'%(location)s due to "%(exc)s"') % exc_info
|
||||
raise exception.StackValidationFailed(message=msg)
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
import functools
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
@ -155,7 +154,7 @@ class ResourceChain(stack_resource.StackResource):
|
|||
return {}
|
||||
|
||||
def _attribute_output_name(self, *attr_path):
|
||||
return ', '.join(six.text_type(a) for a in attr_path)
|
||||
return ', '.join(str(a) for a in attr_path)
|
||||
|
||||
def get_attribute(self, key, *path):
|
||||
if key == self.ATTR_ATTRIBUTES and not path:
|
||||
|
@ -198,7 +197,7 @@ class ResourceChain(stack_resource.StackResource):
|
|||
|
||||
def _nested_output_defns(self, resource_names, get_attr_fn, get_res_fn):
|
||||
for attr in self.referenced_attrs():
|
||||
if isinstance(attr, six.string_types):
|
||||
if isinstance(attr, str):
|
||||
key, path = attr, []
|
||||
else:
|
||||
key, path = attr[0], list(attr[1:])
|
||||
|
@ -227,7 +226,7 @@ class ResourceChain(stack_resource.StackResource):
|
|||
@staticmethod
|
||||
def _resource_names(resource_types):
|
||||
"""Returns a list of unique resource names to create."""
|
||||
return [six.text_type(i) for i, t in enumerate(resource_types)]
|
||||
return [str(i) for i, t in enumerate(resource_types)]
|
||||
|
||||
def _build_resource_definition(self, resource_name, resource_type,
|
||||
depends_on=None):
|
||||
|
|
|
@ -15,7 +15,6 @@ import collections
|
|||
import copy
|
||||
import functools
|
||||
import itertools
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
|
@ -306,7 +305,7 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
first_name = next(self._resource_names())
|
||||
test_tmpl = self._assemble_nested([first_name],
|
||||
include_all=True)
|
||||
res_def = next(six.itervalues(test_tmpl.resource_definitions(None)))
|
||||
res_def = next(iter(test_tmpl.resource_definitions(None).values()))
|
||||
# make sure we can resolve the nested resource type
|
||||
self.stack.env.get_class_to_instantiate(res_def.resource_type)
|
||||
|
||||
|
@ -339,12 +338,12 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
if self.REMOVAL_RSRC_LIST in r:
|
||||
# Tolerate string or int list values
|
||||
for n in r[self.REMOVAL_RSRC_LIST]:
|
||||
str_n = six.text_type(n)
|
||||
str_n = str(n)
|
||||
if (str_n in current_blacklist or
|
||||
self.resource_id is None or
|
||||
str_n in insp.member_names(include_failed=True)):
|
||||
yield str_n
|
||||
elif isinstance(n, six.string_types):
|
||||
elif isinstance(n, str):
|
||||
try:
|
||||
refids = self.get_output(self.REFS_MAP)
|
||||
except (exception.NotFound,
|
||||
|
@ -399,9 +398,9 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
def is_blacklisted(name):
|
||||
return name in name_blacklist
|
||||
|
||||
candidates = six.moves.map(six.text_type, itertools.count())
|
||||
candidates = map(str, itertools.count())
|
||||
|
||||
return itertools.islice(six.moves.filterfalse(is_blacklisted,
|
||||
return itertools.islice(itertools.filterfalse(is_blacklisted,
|
||||
candidates),
|
||||
size)
|
||||
|
||||
|
@ -488,7 +487,7 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
def _attribute_output_name(self, *attr_path):
|
||||
if attr_path[0] == self.REFS:
|
||||
return self.REFS
|
||||
return ', '.join(six.text_type(a) for a in attr_path)
|
||||
return ', '.join(str(a) for a in attr_path)
|
||||
|
||||
def get_attribute(self, key, *path):
|
||||
if key == self.REMOVED_RSRC_LIST:
|
||||
|
@ -546,7 +545,7 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
|
||||
def _nested_output_defns(self, resource_names, get_attr_fn, get_res_fn):
|
||||
for attr in self.referenced_attrs():
|
||||
if isinstance(attr, six.string_types):
|
||||
if isinstance(attr, str):
|
||||
key, path = attr, []
|
||||
else:
|
||||
key, path = attr[0], list(attr[1:])
|
||||
|
@ -611,7 +610,7 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
if isinstance(snippet, collections.Mapping):
|
||||
return dict((k, ignore_param_resolve(v))
|
||||
for k, v in snippet.items())
|
||||
elif (not isinstance(snippet, six.string_types) and
|
||||
elif (not isinstance(snippet, str) and
|
||||
isinstance(snippet, collections.Iterable)):
|
||||
return [ignore_param_resolve(v) for v in snippet]
|
||||
|
||||
|
@ -639,7 +638,7 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
def recurse(x):
|
||||
return self._handle_repl_val(res_name, x)
|
||||
|
||||
if isinstance(val, six.string_types):
|
||||
if isinstance(val, str):
|
||||
return val.replace(repl_var, res_name)
|
||||
elif isinstance(val, collections.Mapping):
|
||||
return {k: recurse(v) for k, v in val.items()}
|
||||
|
@ -706,7 +705,7 @@ class ResourceGroup(stack_resource.StackResource):
|
|||
|
||||
old_resources = sorted(valid_resources, key=replace_priority)
|
||||
existing_names = set(n for n, d in valid_resources)
|
||||
new_names = six.moves.filterfalse(lambda n: n in existing_names,
|
||||
new_names = itertools.filterfalse(lambda n: n in existing_names,
|
||||
names)
|
||||
res_def = self.get_resource_def(include_all)
|
||||
definitions = scl_template.member_definitions(
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -186,9 +185,9 @@ class AutoScalingPolicy(signal_responder.SignalResponder):
|
|||
if self.resource_id is None:
|
||||
return
|
||||
if name == self.ALARM_URL:
|
||||
return six.text_type(self._get_ec2_signed_url())
|
||||
return str(self._get_ec2_signed_url())
|
||||
elif name == self.SIGNAL_URL:
|
||||
return six.text_type(self._get_heat_signal_url())
|
||||
return str(self._get_heat_signal_url())
|
||||
|
||||
|
||||
def resource_mapping():
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
import copy
|
||||
import six
|
||||
from six import itertools
|
||||
import itertools
|
||||
import uuid
|
||||
|
||||
from oslo_config import cfg
|
||||
|
@ -749,7 +748,7 @@ class SoftwareDeploymentGroup(resource_group.ResourceGroup):
|
|||
|
||||
def _nested_output_defns(self, resource_names, get_attr_fn, get_res_fn):
|
||||
for attr in self.referenced_attrs():
|
||||
key = attr if isinstance(attr, six.string_types) else attr[0]
|
||||
key = attr if isinstance(attr, str) else attr[0]
|
||||
n_attr = self._member_attribute_name(key)
|
||||
output_name = self._attribute_output_name(self.ATTR_ATTRIBUTES,
|
||||
n_attr)
|
||||
|
|
Loading…
Reference in New Issue