Merge "Remove six and python 2.7 full support"
This commit is contained in:
commit
cf2da462f8
|
@ -12,8 +12,6 @@
|
|||
# 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 _
|
||||
from heat.engine import attributes
|
||||
|
@ -298,7 +296,7 @@ class SaharaJob(signal_responder.SignalResponder, resource.Resource):
|
|||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == self.DEFAULT_EXECUTION_URL:
|
||||
return six.text_type(self._get_ec2_signed_url())
|
||||
return str(self._get_ec2_signed_url())
|
||||
elif name == self.EXECUTIONS:
|
||||
try:
|
||||
job_execs = self.client().job_executions.find(
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# limitations under the License.
|
||||
|
||||
import re
|
||||
import six
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import encodeutils
|
||||
|
@ -284,7 +283,7 @@ class SaharaNodeGroupTemplate(resource.Resource):
|
|||
return props
|
||||
|
||||
def handle_create(self):
|
||||
props = dict((k, v) for k, v in six.iteritems(self.properties))
|
||||
props = dict((k, v) for k, v in self.properties.items())
|
||||
args = self._prepare_properties(props)
|
||||
node_group_template = self.client().node_group_templates.create(**args)
|
||||
LOG.info("Node Group Template '%s' has been created",
|
||||
|
@ -335,7 +334,7 @@ class SaharaNodeGroupTemplate(resource.Resource):
|
|||
self.properties[self.PLUGIN_NAME],
|
||||
self.properties[self.HADOOP_VERSION])
|
||||
allowed_processes = [item for sublist in
|
||||
list(six.itervalues(plugin.node_processes))
|
||||
list(plugin.node_processes.values())
|
||||
for item in sublist]
|
||||
unsupported_processes = []
|
||||
for process in self.properties[self.NODE_PROCESSES]:
|
||||
|
@ -564,7 +563,7 @@ class SaharaClusterTemplate(resource.Resource):
|
|||
return props
|
||||
|
||||
def handle_create(self):
|
||||
props = dict((k, v) for k, v in six.iteritems(self.properties))
|
||||
props = dict((k, v) for k, v in self.properties.items())
|
||||
args = self._prepare_properties(props)
|
||||
cluster_template = self.client().cluster_templates.create(**args)
|
||||
LOG.info("Cluster Template '%s' has been created",
|
||||
|
|
|
@ -12,8 +12,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.engine import attributes
|
||||
|
@ -319,7 +317,7 @@ class Cluster(res_base.BaseSenlinResource):
|
|||
actions.append(action)
|
||||
# Update cluster
|
||||
if any(p in prop_diff for p in UPDATE_PROPS):
|
||||
params = dict((k, v) for k, v in six.iteritems(prop_diff)
|
||||
params = dict((k, v) for k, v in prop_diff.items()
|
||||
if k in UPDATE_PROPS)
|
||||
params['cluster'] = cluster_obj
|
||||
if self.PROFILE in params:
|
||||
|
@ -333,7 +331,7 @@ class Cluster(res_base.BaseSenlinResource):
|
|||
actions.append(action)
|
||||
# Resize Cluster
|
||||
if any(p in prop_diff for p in RESIZE_PROPS):
|
||||
params = dict((k, v) for k, v in six.iteritems(prop_diff)
|
||||
params = dict((k, v) for k, v in prop_diff.items()
|
||||
if k in RESIZE_PROPS)
|
||||
if self.DESIRED_CAPACITY in params:
|
||||
params['adjustment_type'] = 'EXACT_CAPACITY'
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
# under the License.
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from urllib import parse
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -224,10 +223,10 @@ class SwiftContainer(resource.Resource):
|
|||
self.client().get_container(self.resource_id)
|
||||
|
||||
def get_reference_id(self):
|
||||
return six.text_type(self.resource_id)
|
||||
return str(self.resource_id)
|
||||
|
||||
def _resolve_attribute(self, key):
|
||||
parsed = list(urlparse.urlparse(self.client().url))
|
||||
parsed = list(parse.urlparse(self.client().url))
|
||||
if key == self.DOMAIN_NAME:
|
||||
return parsed[1].split(':')[0]
|
||||
elif key == self.WEBSITE_URL:
|
||||
|
|
|
@ -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 _
|
||||
|
@ -501,9 +500,9 @@ class Instance(resource.Resource):
|
|||
# we retrieve it and try to update it so check again
|
||||
if self.client_plugin().is_over_limit(exc):
|
||||
LOG.debug("API rate limit: %(ex)s. Retrying.",
|
||||
{'ex': six.text_type(exc)})
|
||||
{'ex': str(exc)})
|
||||
return False
|
||||
if "No change was requested" in six.text_type(exc):
|
||||
if "No change was requested" in str(exc):
|
||||
LOG.warning("Unexpected instance state change "
|
||||
"during update. Retrying.")
|
||||
return False
|
||||
|
@ -518,8 +517,8 @@ class Instance(resource.Resource):
|
|||
|
||||
def _update_flavor(self, instance, new_flavor):
|
||||
if new_flavor:
|
||||
current_flav = six.text_type(instance.flavor['id'])
|
||||
new_flav = six.text_type(new_flavor)
|
||||
current_flav = str(instance.flavor['id'])
|
||||
new_flav = str(new_flavor)
|
||||
if new_flav != current_flav:
|
||||
dmsg = "Resizing instance flavor from %(old)s to %(new)s"
|
||||
LOG.debug(dmsg % {"old": current_flav, "new": new_flav})
|
||||
|
|
|
@ -20,7 +20,7 @@ from heat.engine import properties
|
|||
from heat.engine import resource
|
||||
from heat.engine import support
|
||||
|
||||
from six.moves.urllib import parse as urlparse
|
||||
from urllib import parse
|
||||
|
||||
|
||||
class ZaqarQueue(resource.Resource):
|
||||
|
@ -120,7 +120,7 @@ class ZaqarQueue(resource.Resource):
|
|||
queue_name = self.physical_resource_name()
|
||||
return '%s/v%s/queues/%s' % (client.api_url.rstrip('/'),
|
||||
client.api_version,
|
||||
urlparse.quote(queue_name))
|
||||
parse.quote(queue_name))
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
if name == self.QUEUE_ID:
|
||||
|
@ -243,7 +243,7 @@ class ZaqarSignedQueueURL(resource.Resource):
|
|||
'project_id': data[self.PROJECT],
|
||||
'queue_name': self.properties[self.QUEUE],
|
||||
}
|
||||
return urlparse.urlencode(query)
|
||||
return parse.urlencode(query)
|
||||
|
||||
def handle_delete(self):
|
||||
# We can't delete a signed URL
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from urllib import parse
|
||||
|
||||
from keystoneclient.contrib.ec2 import utils as ec2_utils
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -154,7 +154,7 @@ class SignalResponder(stack_user.StackUser):
|
|||
endpoint = heat_client_plugin.get_heat_cfn_url()
|
||||
signal_url = ''.join([endpoint, signal_type])
|
||||
|
||||
host_url = urlparse.urlparse(signal_url)
|
||||
host_url = parse.urlparse(signal_url)
|
||||
|
||||
path = self.identifier().arn_url_path()
|
||||
|
||||
|
@ -162,7 +162,7 @@ class SignalResponder(stack_user.StackUser):
|
|||
# processing in the CFN API (ec2token.py) has an unquoted path, so we
|
||||
# need to calculate the signature with the path component unquoted, but
|
||||
# ensure the actual URL contains the quoted version...
|
||||
unquoted_path = urlparse.unquote(host_url.path + path)
|
||||
unquoted_path = parse.unquote(host_url.path + path)
|
||||
request = {'host': host_url.netloc.lower(),
|
||||
'verb': SIGNAL_VERB[signal_type],
|
||||
'path': unquoted_path,
|
||||
|
@ -176,7 +176,7 @@ class SignalResponder(stack_user.StackUser):
|
|||
signer = ec2_utils.Ec2Signer(secret_key)
|
||||
request['params']['Signature'] = signer.generate(request)
|
||||
|
||||
qs = urlparse.urlencode(request['params'])
|
||||
qs = parse.urlencode(request['params'])
|
||||
url = "%s%s?%s" % (signal_url.lower(),
|
||||
path, qs)
|
||||
|
||||
|
@ -208,7 +208,7 @@ class SignalResponder(stack_user.StackUser):
|
|||
if project_id is not None:
|
||||
path = project_id + path[path.find('/'):]
|
||||
|
||||
url = urlparse.urljoin(url, '%s/signal' % path)
|
||||
url = parse.urljoin(url, '%s/signal' % path)
|
||||
|
||||
self.data_set('heat_signal_url', url)
|
||||
return url
|
||||
|
|
|
@ -18,7 +18,6 @@ from oslo_config import cfg
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import reflection
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -397,7 +396,7 @@ class StackResource(resource.Resource):
|
|||
if not class_name.endswith('_Remote'):
|
||||
return False
|
||||
|
||||
full_message = six.text_type(ex)
|
||||
full_message = str(ex)
|
||||
if full_message.find('\n') > -1:
|
||||
message, msg_trace = full_message.split('\n', 1)
|
||||
else:
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from requests import exceptions
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common import grouputils
|
||||
|
@ -98,7 +97,7 @@ class TemplateResource(stack_resource.StackResource):
|
|||
try:
|
||||
return urlfetch.get(template_name, allowed_schemes=allowed_schemes)
|
||||
except (IOError, exceptions.RequestException) as r_exc:
|
||||
args = {'name': template_name, 'exc': six.text_type(r_exc)}
|
||||
args = {'name': template_name, 'exc': str(r_exc)}
|
||||
msg = _('Could not fetch remote template '
|
||||
'"%(name)s": %(exc)s') % args
|
||||
raise exception.NotFound(msg_fmt=msg)
|
||||
|
@ -290,7 +289,7 @@ class TemplateResource(stack_resource.StackResource):
|
|||
|
||||
def validate_template(self):
|
||||
if self.validation_exception is not None:
|
||||
msg = six.text_type(self.validation_exception)
|
||||
msg = str(self.validation_exception)
|
||||
raise exception.StackValidationFailed(message=msg)
|
||||
|
||||
return super(TemplateResource, self).validate_template()
|
||||
|
@ -317,7 +316,7 @@ class TemplateResource(stack_resource.StackResource):
|
|||
|
||||
def get_reference_id(self):
|
||||
if self.resource_id is None:
|
||||
return six.text_type(self.name)
|
||||
return str(self.name)
|
||||
|
||||
if STACK_ID_OUTPUT in self.attributes.cached_attrs:
|
||||
return self.attributes.cached_attrs[STACK_ID_OUTPUT]
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
import collections
|
||||
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -70,7 +69,7 @@ class BaseWaitConditionHandle(signal_responder.SignalResponder):
|
|||
raise ValueError(_("Metadata format invalid"))
|
||||
|
||||
new_entry = signal_data.copy()
|
||||
unique_id = six.text_type(new_entry.pop(self.UNIQUE_ID))
|
||||
unique_id = str(new_entry.pop(self.UNIQUE_ID))
|
||||
|
||||
new_rsrc_metadata = latest_rsrc_metadata.copy()
|
||||
if unique_id in new_rsrc_metadata:
|
||||
|
@ -92,12 +91,12 @@ class BaseWaitConditionHandle(signal_responder.SignalResponder):
|
|||
def get_status(self):
|
||||
"""Return a list of the Status values for the handle signals."""
|
||||
return [v[self.STATUS]
|
||||
for v in six.itervalues(self.metadata_get(refresh=True))]
|
||||
for v in self.metadata_get(refresh=True).values()]
|
||||
|
||||
def get_status_reason(self, status):
|
||||
"""Return a list of reasons associated with a particular status."""
|
||||
return [v[self.REASON]
|
||||
for v in six.itervalues(self.metadata_get(refresh=True))
|
||||
for v in self.metadata_get(refresh=True).values()
|
||||
if v[self.STATUS] == status]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue