Merge "Remove six and python 2.7 full support"
This commit is contained in:
commit
7dc1a4b46f
|
@ -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.engine import properties
|
||||
|
@ -102,7 +100,7 @@ class VPCGatewayAttachment(resource.Resource):
|
|||
default_client_name = 'neutron'
|
||||
|
||||
def _vpc_route_tables(self, ignore_errors=False):
|
||||
for res in six.itervalues(self.stack):
|
||||
for res in self.stack.values():
|
||||
if res.has_interface('AWS::EC2::RouteTable'):
|
||||
try:
|
||||
vpc_id = self.properties[self.VPC_ID]
|
||||
|
|
|
@ -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.engine import properties
|
||||
|
@ -169,12 +167,12 @@ class NeutronSecurityGroup(object):
|
|||
rule['direction'] = 'egress'
|
||||
for rule in updated[self.sg.SECURITY_GROUP_INGRESS]:
|
||||
rule['direction'] = 'ingress'
|
||||
updated_rules = list(six.itervalues(updated))
|
||||
updated_rules = list(updated.values())
|
||||
updated_all = updated_rules[0] + updated_rules[1]
|
||||
ids_to_delete = [id for id, rule in existing.items()
|
||||
if rule not in updated_all]
|
||||
rules_to_create = [rule for rule in updated_all
|
||||
if rule not in six.itervalues(existing)]
|
||||
if rule not in existing.values()]
|
||||
return ids_to_delete, rules_to_create
|
||||
|
||||
|
||||
|
|
|
@ -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 _
|
||||
|
@ -80,7 +79,7 @@ class User(stack_user.StackUser):
|
|||
# If a non-string (e.g embedded IAM dict policy) is passed, we
|
||||
# ignore the policy (don't reject it because we previously ignored
|
||||
# and we don't want to break templates which previously worked
|
||||
if not isinstance(policy, six.string_types):
|
||||
if not isinstance(policy, str):
|
||||
LOG.debug("Ignoring policy %s, must be string "
|
||||
"resource name", policy)
|
||||
continue
|
||||
|
@ -118,7 +117,7 @@ class User(stack_user.StackUser):
|
|||
def access_allowed(self, resource_name):
|
||||
policies = (self.properties[self.POLICIES] or [])
|
||||
for policy in policies:
|
||||
if not isinstance(policy, six.string_types):
|
||||
if not isinstance(policy, str):
|
||||
LOG.debug("Ignoring policy %s, must be string "
|
||||
"resource name", policy)
|
||||
continue
|
||||
|
|
|
@ -14,7 +14,6 @@ import os
|
|||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -623,7 +622,7 @@ backend servers
|
|||
'Interval must be larger than Timeout'}
|
||||
|
||||
def get_reference_id(self):
|
||||
return six.text_type(self.name)
|
||||
return str(self.name)
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
"""We don't really support any of these yet."""
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
# 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 six.moves.urllib import parse as urlparse
|
||||
from urllib import parse
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -165,11 +164,11 @@ class S3Bucket(resource.Resource):
|
|||
self.client_plugin().ignore_not_found(ex)
|
||||
|
||||
def get_reference_id(self):
|
||||
return six.text_type(self.resource_id)
|
||||
return str(self.resource_id)
|
||||
|
||||
def _resolve_attribute(self, name):
|
||||
url = self.client().get_auth()[0]
|
||||
parsed = list(urlparse.urlparse(url))
|
||||
parsed = list(parse.urlparse(url))
|
||||
if name == self.DOMAIN_NAME:
|
||||
return parsed[1].split(':')[0]
|
||||
elif name == self.WEBSITE_URL:
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from heat.common.i18n import _
|
||||
from heat.engine import constraints
|
||||
from heat.engine import properties
|
||||
|
@ -157,7 +155,7 @@ class AodhAlarm(alarm_base.BaseAlarm):
|
|||
|
||||
# make sure the matching_metadata appears in the query like this:
|
||||
# {field: metadata.$prefix.x, ...}
|
||||
for m_k, m_v in six.iteritems(mmd):
|
||||
for m_k, m_v in mmd.items():
|
||||
key = 'metadata.%s' % prefix
|
||||
if m_k.startswith('metadata.'):
|
||||
m_k = m_k[len('metadata.'):]
|
||||
|
@ -168,7 +166,7 @@ class AodhAlarm(alarm_base.BaseAlarm):
|
|||
# NOTE(prazumovsky): type of query value must be a string, but
|
||||
# matching_metadata value type can not be a string, so we
|
||||
# must convert value to a string type.
|
||||
query.append(dict(field=key, op='eq', value=six.text_type(m_v)))
|
||||
query.append(dict(field=key, op='eq', value=str(m_v)))
|
||||
if self.MATCHING_METADATA in kwargs:
|
||||
del kwargs[self.MATCHING_METADATA]
|
||||
if self.QUERY in kwargs:
|
||||
|
|
|
@ -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.engine import attributes
|
||||
|
@ -192,12 +190,12 @@ class CertificateContainer(GenericContainer):
|
|||
}
|
||||
|
||||
def create_container(self):
|
||||
info = dict((k, v) for k, v in six.iteritems(self.properties)
|
||||
info = dict((k, v) for k, v in self.properties.items()
|
||||
if v is not None)
|
||||
return self.client_plugin().create_certificate(**info)
|
||||
|
||||
def get_refs(self):
|
||||
return [v for k, v in six.iteritems(self.properties)
|
||||
return [v for k, v in self.properties.items()
|
||||
if (k != self.NAME and v is not None)]
|
||||
|
||||
|
||||
|
@ -239,12 +237,12 @@ class RSAContainer(GenericContainer):
|
|||
}
|
||||
|
||||
def create_container(self):
|
||||
info = dict((k, v) for k, v in six.iteritems(self.properties)
|
||||
info = dict((k, v) for k, v in self.properties.items()
|
||||
if v is not None)
|
||||
return self.client_plugin().create_rsa(**info)
|
||||
|
||||
def get_refs(self):
|
||||
return [v for k, v in six.iteritems(self.properties)
|
||||
return [v for k, v in self.properties.items()
|
||||
if (k != self.NAME and v is not None)]
|
||||
|
||||
|
||||
|
|
|
@ -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.engine import attributes
|
||||
|
@ -228,8 +226,8 @@ class Order(resource.Resource):
|
|||
raise exception.ResourcePropertyDependency(
|
||||
prop1=self.PROFILE, prop2=self.CA_ID
|
||||
)
|
||||
declared_props = sorted([k for k, v in six.iteritems(
|
||||
self.properties) if k != self.TYPE and v is not None])
|
||||
declared_props = sorted([k for k, v in self.properties.items()
|
||||
if k != self.TYPE and v is not None])
|
||||
allowed_props = sorted(self.ALLOWED_PROPERTIES_FOR_TYPE[
|
||||
self.properties[self.TYPE]])
|
||||
diff = sorted(set(declared_props) - set(allowed_props))
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from heat.common import exception
|
||||
from heat.common.i18n import _
|
||||
|
@ -310,7 +309,7 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
|||
cinder = self.client()
|
||||
vol = cinder.volumes.get(self.resource_id)
|
||||
if name == self.METADATA_ATTR:
|
||||
return six.text_type(jsonutils.dumps(vol.metadata))
|
||||
return str(jsonutils.dumps(vol.metadata))
|
||||
elif name == self.METADATA_VALUES_ATTR:
|
||||
return vol.metadata
|
||||
if name == self.DISPLAY_NAME_ATTR:
|
||||
|
@ -319,7 +318,7 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
|||
return vol.description
|
||||
elif name == self.ATTACHMENTS_LIST:
|
||||
return vol.attachments
|
||||
return six.text_type(getattr(vol, name))
|
||||
return str(getattr(vol, name))
|
||||
|
||||
def check_create_complete(self, vol_id):
|
||||
complete = super(CinderVolume, self).check_create_complete(vol_id)
|
||||
|
@ -355,7 +354,7 @@ class CinderVolume(vb.BaseVolume, sh.SchedulerHintsMixin):
|
|||
if self.client_plugin().is_client_exception(ex):
|
||||
raise exception.Error(_(
|
||||
"Failed to extend volume %(vol)s - %(err)s") % {
|
||||
'vol': self.resource_id, 'err': six.text_type(ex)})
|
||||
'vol': self.resource_id, 'err': str(ex)})
|
||||
else:
|
||||
raise
|
||||
return 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.engine import constraints
|
||||
|
@ -99,7 +97,7 @@ class DesignateRecordSet(resource.Resource):
|
|||
entity = 'recordsets'
|
||||
|
||||
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)
|
||||
if not args.get(self.NAME):
|
||||
args[self.NAME] = self.physical_resource_name()
|
||||
|
|
Loading…
Reference in New Issue