Merge "Remove six and python 2.7 full support"

This commit is contained in:
Zuul 2020-04-27 16:10:27 +00:00 committed by Gerrit Code Review
commit 8e66a64f5f
10 changed files with 20 additions and 31 deletions

View File

@ -14,7 +14,6 @@
import copy
from oslo_serialization import jsonutils
import six
import yaml
from heat.common import exception
@ -555,7 +554,7 @@ class Workflow(signal_responder.SignalResponder,
if props.get(self.TASK_DEFAULTS) is not None:
definition[defn_name][self.TASK_DEFAULTS.replace('_', '-')] = {
k.replace('_', '-'): v for k, v in
six.iteritems(props.get(self.TASK_DEFAULTS)) if v}
props.get(self.TASK_DEFAULTS).items() if v}
return yaml.dump(definition, Dumper=yaml.CSafeDumper
if hasattr(yaml, 'CSafeDumper')
@ -647,8 +646,8 @@ class Workflow(signal_responder.SignalResponder,
'created_at': execution.created_at,
'updated_at': execution.updated_at,
'state': execution.state,
'input': jsonutils.loads(six.text_type(execution.input)),
'output': jsonutils.loads(six.text_type(execution.output))
'input': jsonutils.loads(str(execution.input)),
'output': jsonutils.loads(str(execution.output))
}
return [parse_execution_response(
@ -661,7 +660,7 @@ class Workflow(signal_responder.SignalResponder,
self.INPUT: self.properties.get(self.INPUT)}
elif name == self.ALARM_URL and self.resource_id is not None:
return six.text_type(self._get_ec2_signed_url())
return str(self._get_ec2_signed_url())
def resource_mapping():

View File

@ -12,7 +12,7 @@
# under the License.
import re
from six.moves import urllib
from urllib import parse
from heat.common import exception
from heat.common.i18n import _
@ -115,7 +115,7 @@ class MonascaNotification(resource.Resource):
if self.properties[self.TYPE] == self.WEBHOOK:
try:
parsed_address = urllib.parse.urlparse(address)
parsed_address = parse.urlparse(address)
except Exception:
msg = _('Address "%(addr)s" should have correct format '
'required by "%(wh)s" type of "%(type)s" '

View File

@ -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 constraints
@ -62,7 +60,7 @@ class ExtraRoute(neutron.NeutronResource):
def add_dependencies(self, deps):
super(ExtraRoute, self).add_dependencies(deps)
for resource in six.itervalues(self.stack):
for resource in self.stack.values():
# depend on any RouterInterface in this template with the same
# router_id as this router_id
if resource.has_interface('OS::Neutron::RouterInterface'):

View File

@ -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 oslo_log import log as logging
@ -238,7 +237,7 @@ class FloatingIP(neutron.NeutronResource):
except Exception as exc:
LOG.info("Ignoring Neutron error while "
"getting FloatingIP dependencies: %s",
six.text_type(exc))
str(exc))
return False
else:
try:
@ -265,7 +264,7 @@ class FloatingIP(neutron.NeutronResource):
def add_dependencies(self, deps):
super(FloatingIP, self).add_dependencies(deps)
for resource in six.itervalues(self.stack):
for resource in self.stack.values():
# depend on any RouterGateway in this template with the same
# network_id as this floating_network_id
if resource.has_interface('OS::Neutron::RouterGateway'):
@ -388,7 +387,7 @@ class FloatingIPAssociation(neutron.NeutronResource):
def add_dependencies(self, deps):
super(FloatingIPAssociation, self).add_dependencies(deps)
for resource in six.itervalues(self.stack):
for resource in self.stack.values():
if resource.has_interface('OS::Neutron::RouterInterface'):
def port_on_subnet(resource, subnet):

View File

@ -13,7 +13,6 @@
# under the License.
import collections
import six
from heat.common.i18n import _
from heat.engine import properties
@ -111,7 +110,7 @@ class L2Gateway(neutron.NeutronResource):
return dict((k, L2Gateway._remove_none_value_props(v)) for k, v
in props.items() if v is not None)
elif (isinstance(props, collections.Sequence) and
not isinstance(props, six.string_types)):
not isinstance(props, str)):
return list(L2Gateway._remove_none_value_props(l) for l in props
if l is not None)
return props

View File

@ -13,7 +13,6 @@
from oslo_log import log as logging
from oslo_serialization import jsonutils
import six
from heat.common.i18n import _
from heat.engine import attributes
@ -437,7 +436,7 @@ class Port(neutron.NeutronResource):
# It is not known which subnet a port might be assigned
# to so all subnets in a network should be created before
# the ports in that network.
for res in six.itervalues(self.stack):
for res in self.stack.values():
if res.has_interface('OS::Neutron::Subnet'):
try:
dep_network = res.properties.get(subnet.Subnet.NETWORK)

View File

@ -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
@ -266,7 +264,7 @@ class Router(neutron.NeutronResource):
external_gw = self.properties[self.EXTERNAL_GATEWAY]
if external_gw:
external_gw_net = external_gw.get(self.EXTERNAL_GATEWAY_NETWORK)
for res in six.itervalues(self.stack):
for res in self.stack.values():
if res.has_interface('OS::Neutron::Subnet'):
try:
subnet_net = res.properties.get(subnet.Subnet.NETWORK)
@ -639,7 +637,7 @@ class RouterGateway(neutron.NeutronResource):
def add_dependencies(self, deps):
super(RouterGateway, self).add_dependencies(deps)
for resource in six.itervalues(self.stack):
for resource in self.stack.values():
# depend on any RouterInterface in this template with the same
# router_id as this router_id
if resource.has_interface('OS::Neutron::RouterInterface'):

View File

@ -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 _
@ -123,7 +122,7 @@ class NovaFloatingIp(resource.Resource):
self.POOL_ATTR: floating_ip['floatingip']['floating_network_id'],
self.IP: floating_ip['floatingip']['floating_ip_address']
}
return six.text_type(attributes[key])
return str(attributes[key])
class NovaFloatingIpAssociation(resource.Resource):

View File

@ -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 _
@ -192,7 +191,7 @@ class KeyPair(resource.Resource):
def _resolve_attribute(self, key):
attr_fn = {self.PRIVATE_KEY_ATTR: self.private_key,
self.PUBLIC_KEY_ATTR: self.public_key}
return six.text_type(attr_fn[key])
return str(attr_fn[key])
def get_reference_id(self):
return self.resource_id

View File

@ -16,7 +16,6 @@ import copy
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import uuidutils
import six
from heat.common import exception
from heat.common.i18n import _
@ -944,8 +943,8 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
server, server_data = resource_data
result = {
# there's a risk that flavor id will be int type, so cast to str
self.FLAVOR: six.text_type(server_data.get(self.FLAVOR)['id']),
self.IMAGE: six.text_type(server_data.get(self.IMAGE)['id']),
self.FLAVOR: str(server_data.get(self.FLAVOR)['id']),
self.IMAGE: str(server_data.get(self.IMAGE)['id']),
self.NAME: server_data.get(self.NAME),
self.METADATA: server_data.get(self.METADATA),
self.NETWORKS: self._get_live_networks(server, resource_properties)
@ -985,7 +984,7 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
reality_net_ids.get(net_id).pop(idx)
break
for key, value in six.iteritems(reality_nets):
for key, value in reality_nets.items():
for address in reality_nets[key]:
new_net = {self.NETWORK_ID: key,
self.NETWORK_FIXED_IP: address['addr']}
@ -1232,7 +1231,7 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
return
if not nets:
return
for res in six.itervalues(self.stack):
for res in self.stack.values():
if res.has_interface('OS::Neutron::Subnet'):
try:
subnet_net = res.properties.get(subnet.Subnet.NETWORK)