Use six.itervalues(x) instead of x.values()
Change-Id: Ie71072940b7b5e599d9012be0bc1874b2a623003 Partial-Bug: #1446254
This commit is contained in:
parent
5854f1d121
commit
4c6810ce1a
@ -176,7 +176,7 @@ class Attributes(collections.Mapping):
|
|||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return ("Attributes for %s:\n\t" % self._resource_name +
|
return ("Attributes for %s:\n\t" % self._resource_name +
|
||||||
'\n\t'.join(self._attributes.values()))
|
'\n\t'.join(six.itervalues(self._attributes)))
|
||||||
|
|
||||||
|
|
||||||
def select_from_attribute(attribute_value, path):
|
def select_from_attribute(attribute_value, path):
|
||||||
|
@ -147,10 +147,11 @@ class ClientPlugin(object):
|
|||||||
if self.exceptions_module:
|
if self.exceptions_module:
|
||||||
if isinstance(self.exceptions_module, list):
|
if isinstance(self.exceptions_module, list):
|
||||||
for m in self.exceptions_module:
|
for m in self.exceptions_module:
|
||||||
if type(ex) in m.__dict__.values():
|
if type(ex) in six.itervalues(m.__dict__):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return type(ex) in self.exceptions_module.__dict__.values()
|
return type(ex) in six.itervalues(
|
||||||
|
self.exceptions_module.__dict__)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_not_found(self, ex):
|
def is_not_found(self, ex):
|
||||||
|
@ -133,7 +133,7 @@ class Schema(collections.Mapping):
|
|||||||
if isinstance(self.schema, AnyIndexDict):
|
if isinstance(self.schema, AnyIndexDict):
|
||||||
self.schema.value.validate(context)
|
self.schema.value.validate(context)
|
||||||
else:
|
else:
|
||||||
for nested_schema in self.schema.values():
|
for nested_schema in six.itervalues(self.schema):
|
||||||
nested_schema.validate(context)
|
nested_schema.validate(context)
|
||||||
|
|
||||||
def _validate_default(self, context):
|
def _validate_default(self, context):
|
||||||
|
@ -132,7 +132,7 @@ def validate(snippet):
|
|||||||
if isinstance(snippet, Function):
|
if isinstance(snippet, Function):
|
||||||
snippet.validate()
|
snippet.validate()
|
||||||
elif isinstance(snippet, collections.Mapping):
|
elif isinstance(snippet, collections.Mapping):
|
||||||
for v in snippet.values():
|
for v in six.itervalues(snippet):
|
||||||
validate(v)
|
validate(v)
|
||||||
elif (not isinstance(snippet, six.string_types) and
|
elif (not isinstance(snippet, six.string_types) and
|
||||||
isinstance(snippet, collections.Iterable)):
|
isinstance(snippet, collections.Iterable)):
|
||||||
|
@ -170,7 +170,8 @@ class HOTemplate20130523(template.Template):
|
|||||||
self._RESOURCE_HOT_TO_CFN_ATTRS)
|
self._RESOURCE_HOT_TO_CFN_ATTRS)
|
||||||
|
|
||||||
def get_section_name(self, section):
|
def get_section_name(self, section):
|
||||||
cfn_to_hot_attrs = dict(zip(self._RESOURCE_HOT_TO_CFN_ATTRS.values(),
|
cfn_to_hot_attrs = dict(
|
||||||
|
zip(six.itervalues(self._RESOURCE_HOT_TO_CFN_ATTRS),
|
||||||
self._RESOURCE_HOT_TO_CFN_ATTRS.keys()))
|
self._RESOURCE_HOT_TO_CFN_ATTRS.keys()))
|
||||||
return cfn_to_hot_attrs.get(section, section)
|
return cfn_to_hot_attrs.get(section, section)
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ class Parameters(collections.Mapping):
|
|||||||
self._validate_tmpl_parameters()
|
self._validate_tmpl_parameters()
|
||||||
self._validate_user_parameters()
|
self._validate_user_parameters()
|
||||||
|
|
||||||
for param in self.params.values():
|
for param in six.itervalues(self.params):
|
||||||
param.validate(validate_value, context)
|
param.validate(validate_value, context)
|
||||||
|
|
||||||
def __contains__(self, key):
|
def __contains__(self, key):
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
from heat.engine import properties
|
from heat.engine import properties
|
||||||
@ -100,7 +102,7 @@ class VPCGatewayAttachment(resource.Resource):
|
|||||||
default_client_name = 'neutron'
|
default_client_name = 'neutron'
|
||||||
|
|
||||||
def _vpc_route_tables(self):
|
def _vpc_route_tables(self):
|
||||||
for res in self.stack.itervalues():
|
for res in six.itervalues(self.stack):
|
||||||
if (res.has_interface('AWS::EC2::RouteTable') and
|
if (res.has_interface('AWS::EC2::RouteTable') and
|
||||||
res.properties.get(route_table.RouteTable.VPC_ID) ==
|
res.properties.get(route_table.RouteTable.VPC_ID) ==
|
||||||
self.properties.get(self.VPC_ID)):
|
self.properties.get(self.VPC_ID)):
|
||||||
|
@ -43,7 +43,7 @@ class BaseSecurityGroup(object):
|
|||||||
ids_to_delete = [id for id, rule in existing.items()
|
ids_to_delete = [id for id, rule in existing.items()
|
||||||
if rule not in updated]
|
if rule not in updated]
|
||||||
rules_to_create = [rule for rule in updated
|
rules_to_create = [rule for rule in updated
|
||||||
if rule not in existing.values()]
|
if rule not in six.itervalues(existing)]
|
||||||
return ids_to_delete, rules_to_create
|
return ids_to_delete, rules_to_create
|
||||||
|
|
||||||
|
|
||||||
@ -320,7 +320,8 @@ class NeutronSecurityGroup(BaseSecurityGroup):
|
|||||||
rule['direction'] = 'egress'
|
rule['direction'] = 'egress'
|
||||||
for rule in updated[self.sg.SECURITY_GROUP_INGRESS]:
|
for rule in updated[self.sg.SECURITY_GROUP_INGRESS]:
|
||||||
rule['direction'] = 'ingress'
|
rule['direction'] = 'ingress'
|
||||||
updated_all = updated.values()[0] + updated.values()[1]
|
updated_rules = list(six.itervalues(updated))
|
||||||
|
updated_all = updated_rules[0] + updated_rules[1]
|
||||||
return super(NeutronSecurityGroup, self).diff_rules(existing,
|
return super(NeutronSecurityGroup, self).diff_rules(existing,
|
||||||
updated_all)
|
updated_all)
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ class ResourceGroup(stack_resource.StackResource):
|
|||||||
if isinstance(val, six.string_types):
|
if isinstance(val, six.string_types):
|
||||||
return val.replace(repl_var, res_name)
|
return val.replace(repl_var, res_name)
|
||||||
elif isinstance(val, collections.Mapping):
|
elif isinstance(val, collections.Mapping):
|
||||||
return dict(zip(val, map(recurse, val.values())))
|
return dict(zip(val, map(recurse, six.itervalues(val))))
|
||||||
elif isinstance(val, collections.Sequence):
|
elif isinstance(val, collections.Sequence):
|
||||||
return map(recurse, val)
|
return map(recurse, val)
|
||||||
return val
|
return val
|
||||||
|
@ -110,7 +110,7 @@ class FloatingIP(neutron.NeutronResource):
|
|||||||
def add_dependencies(self, deps):
|
def add_dependencies(self, deps):
|
||||||
super(FloatingIP, self).add_dependencies(deps)
|
super(FloatingIP, self).add_dependencies(deps)
|
||||||
|
|
||||||
for resource in self.stack.itervalues():
|
for resource in six.itervalues(self.stack):
|
||||||
# depend on any RouterGateway in this template with the same
|
# depend on any RouterGateway in this template with the same
|
||||||
# network_id as this floating_network_id
|
# network_id as this floating_network_id
|
||||||
if resource.has_interface('OS::Neutron::RouterGateway'):
|
if resource.has_interface('OS::Neutron::RouterGateway'):
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# 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.i18n import _
|
from heat.common.i18n import _
|
||||||
from heat.common.i18n import _LW
|
from heat.common.i18n import _LW
|
||||||
@ -261,7 +262,7 @@ class Port(neutron.NeutronResource):
|
|||||||
# It is not known which subnet a port might be assigned
|
# It is not known which subnet a port might be assigned
|
||||||
# to so all subnets in a network should be created before
|
# to so all subnets in a network should be created before
|
||||||
# the ports in that network.
|
# the ports in that network.
|
||||||
for res in self.stack.itervalues():
|
for res in six.itervalues(self.stack):
|
||||||
if res.has_interface('OS::Neutron::Subnet'):
|
if res.has_interface('OS::Neutron::Subnet'):
|
||||||
dep_network = res.properties.get(
|
dep_network = res.properties.get(
|
||||||
subnet.Subnet.NETWORK) or res.properties.get(
|
subnet.Subnet.NETWORK) or res.properties.get(
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
from heat.engine import attributes
|
from heat.engine import attributes
|
||||||
@ -171,7 +173,7 @@ class Router(neutron.NeutronResource):
|
|||||||
external_gw = self.properties.get(self.EXTERNAL_GATEWAY)
|
external_gw = self.properties.get(self.EXTERNAL_GATEWAY)
|
||||||
if external_gw:
|
if external_gw:
|
||||||
external_gw_net = external_gw.get(self.EXTERNAL_GATEWAY_NETWORK)
|
external_gw_net = external_gw.get(self.EXTERNAL_GATEWAY_NETWORK)
|
||||||
for res in self.stack.itervalues():
|
for res in six.itervalues(self.stack):
|
||||||
if res.has_interface('OS::Neutron::Subnet'):
|
if res.has_interface('OS::Neutron::Subnet'):
|
||||||
subnet_net = res.properties.get(
|
subnet_net = res.properties.get(
|
||||||
subnet.Subnet.NETWORK) or res.properties.get(
|
subnet.Subnet.NETWORK) or res.properties.get(
|
||||||
@ -434,7 +436,7 @@ class RouterGateway(neutron.NeutronResource):
|
|||||||
|
|
||||||
def add_dependencies(self, deps):
|
def add_dependencies(self, deps):
|
||||||
super(RouterGateway, self).add_dependencies(deps)
|
super(RouterGateway, self).add_dependencies(deps)
|
||||||
for resource in self.stack.itervalues():
|
for resource in six.itervalues(self.stack):
|
||||||
# depend on any RouterInterface in this template with the same
|
# depend on any RouterInterface in this template with the same
|
||||||
# router_id as this router_id
|
# router_id as this router_id
|
||||||
if resource.has_interface('OS::Neutron::RouterInterface'):
|
if resource.has_interface('OS::Neutron::RouterInterface'):
|
||||||
|
@ -902,7 +902,7 @@ class Server(stack_user.StackUser):
|
|||||||
nets = self.properties.get(self.NETWORKS)
|
nets = self.properties.get(self.NETWORKS)
|
||||||
if not nets:
|
if not nets:
|
||||||
return
|
return
|
||||||
for res in self.stack.itervalues():
|
for res in six.itervalues(self.stack):
|
||||||
if res.has_interface('OS::Neutron::Subnet'):
|
if res.has_interface('OS::Neutron::Subnet'):
|
||||||
subnet_net = (res.properties.get(subnet.Subnet.NETWORK_ID)
|
subnet_net = (res.properties.get(subnet.Subnet.NETWORK_ID)
|
||||||
or res.properties.get(subnet.Subnet.NETWORK))
|
or res.properties.get(subnet.Subnet.NETWORK))
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# 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.common.i18n import _
|
from heat.common.i18n import _
|
||||||
@ -78,14 +79,14 @@ class BaseWaitConditionHandle(signal_responder.SignalResponder):
|
|||||||
Return a list of the Status values for the handle signals
|
Return a list of the Status values for the handle signals
|
||||||
'''
|
'''
|
||||||
return [v[self.STATUS]
|
return [v[self.STATUS]
|
||||||
for v in self.metadata_get(refresh=True).values()]
|
for v in six.itervalues(self.metadata_get(refresh=True))]
|
||||||
|
|
||||||
def get_status_reason(self, status):
|
def get_status_reason(self, status):
|
||||||
'''
|
'''
|
||||||
Return a list of reasons associated with a particular status
|
Return a list of reasons associated with a particular status
|
||||||
'''
|
'''
|
||||||
return [v[self.REASON]
|
return [v[self.REASON]
|
||||||
for v in self.metadata_get(refresh=True).values()
|
for v in six.itervalues(self.metadata_get(refresh=True))
|
||||||
if v[self.STATUS] == status]
|
if v[self.STATUS] == status]
|
||||||
|
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ class DependencyTaskGroup(object):
|
|||||||
def __call__(self):
|
def __call__(self):
|
||||||
"""Return a co-routine which runs the task group."""
|
"""Return a co-routine which runs the task group."""
|
||||||
raised_exceptions = []
|
raised_exceptions = []
|
||||||
while any(self._runners.itervalues()):
|
while any(six.itervalues(self._runners)):
|
||||||
try:
|
try:
|
||||||
for k, r in self._ready():
|
for k, r in self._ready():
|
||||||
r.start()
|
r.start()
|
||||||
@ -400,7 +400,7 @@ class DependencyTaskGroup(object):
|
|||||||
raise exc_type, exc_val, traceback
|
raise exc_type, exc_val, traceback
|
||||||
|
|
||||||
def cancel_all(self, grace_period=None):
|
def cancel_all(self, grace_period=None):
|
||||||
for r in self._runners.itervalues():
|
for r in six.itervalues(self._runners):
|
||||||
r.cancel(grace_period=grace_period)
|
r.cancel(grace_period=grace_period)
|
||||||
|
|
||||||
def _cancel_recursively(self, key, runner):
|
def _cancel_recursively(self, key, runner):
|
||||||
|
@ -206,7 +206,7 @@ class ThreadGroupManager(object):
|
|||||||
|
|
||||||
for th in threads:
|
for th in threads:
|
||||||
th.link(mark_done, th)
|
th.link(mark_done, th)
|
||||||
while not all(links_done.values()):
|
while not all(six.itervalues(links_done)):
|
||||||
eventlet.sleep()
|
eventlet.sleep()
|
||||||
|
|
||||||
def send(self, stack_id, message):
|
def send(self, stack_id, message):
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
from heat.common import context
|
from heat.common import context
|
||||||
from heat.common.i18n import _LE
|
from heat.common.i18n import _LE
|
||||||
@ -94,7 +95,7 @@ class StackWatch(object):
|
|||||||
def run_alarm_action(stk, actions, details):
|
def run_alarm_action(stk, actions, details):
|
||||||
for action in actions:
|
for action in actions:
|
||||||
action(details=details)
|
action(details=details)
|
||||||
for res in stk.itervalues():
|
for res in six.itervalues(stk):
|
||||||
res.metadata_update()
|
res.metadata_update()
|
||||||
|
|
||||||
for wr in wrs:
|
for wr in wrs:
|
||||||
|
@ -209,7 +209,7 @@ class Stack(collections.Mapping):
|
|||||||
Iterates over all the resources in a stack, including nested stacks up
|
Iterates over all the resources in a stack, including nested stacks up
|
||||||
to `nested_depth` levels below.
|
to `nested_depth` levels below.
|
||||||
'''
|
'''
|
||||||
for res in self.values():
|
for res in six.itervalues(self):
|
||||||
yield res
|
yield res
|
||||||
|
|
||||||
get_nested = getattr(res, 'nested', None)
|
get_nested = getattr(res, 'nested', None)
|
||||||
@ -239,7 +239,7 @@ class Stack(collections.Mapping):
|
|||||||
def dependencies(self):
|
def dependencies(self):
|
||||||
if self._dependencies is None:
|
if self._dependencies is None:
|
||||||
self._dependencies = self._get_dependencies(
|
self._dependencies = self._get_dependencies(
|
||||||
self.resources.itervalues())
|
six.itervalues(self.resources))
|
||||||
return self._dependencies
|
return self._dependencies
|
||||||
|
|
||||||
def reset_dependencies(self):
|
def reset_dependencies(self):
|
||||||
@ -298,7 +298,8 @@ class Stack(collections.Mapping):
|
|||||||
return nested_stack.total_resources()
|
return nested_stack.total_resources()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
return len(self) + sum(total_nested(res) for res in self.itervalues())
|
return len(self) + sum(total_nested(res)
|
||||||
|
for res in six.itervalues(self))
|
||||||
|
|
||||||
def _set_param_stackid(self):
|
def _set_param_stackid(self):
|
||||||
'''
|
'''
|
||||||
@ -557,7 +558,7 @@ class Stack(collections.Mapping):
|
|||||||
Return the resource in this stack with the specified
|
Return the resource in this stack with the specified
|
||||||
refid, or None if not found
|
refid, or None if not found
|
||||||
'''
|
'''
|
||||||
for r in self.values():
|
for r in six.itervalues(self):
|
||||||
if r.state in (
|
if r.state in (
|
||||||
(r.INIT, r.COMPLETE),
|
(r.INIT, r.COMPLETE),
|
||||||
(r.CREATE, r.IN_PROGRESS),
|
(r.CREATE, r.IN_PROGRESS),
|
||||||
@ -664,7 +665,7 @@ class Stack(collections.Mapping):
|
|||||||
during its lifecycle using the configured deferred authentication
|
during its lifecycle using the configured deferred authentication
|
||||||
method.
|
method.
|
||||||
'''
|
'''
|
||||||
return any(res.requires_deferred_auth for res in self.values())
|
return any(res.requires_deferred_auth for res in six.itervalues(self))
|
||||||
|
|
||||||
@profiler.trace('Stack.state_set', hide_args=False)
|
@profiler.trace('Stack.state_set', hide_args=False)
|
||||||
def state_set(self, action, status, reason):
|
def state_set(self, action, status, reason):
|
||||||
@ -714,7 +715,7 @@ class Stack(collections.Mapping):
|
|||||||
Preview the stack with all of the resources.
|
Preview the stack with all of the resources.
|
||||||
'''
|
'''
|
||||||
return [resource.preview()
|
return [resource.preview()
|
||||||
for resource in self.resources.itervalues()]
|
for resource in six.itervalues(self.resources)]
|
||||||
|
|
||||||
def _store_resources(self):
|
def _store_resources(self):
|
||||||
for r in reversed(self.dependencies):
|
for r in reversed(self.dependencies):
|
||||||
@ -824,7 +825,7 @@ class Stack(collections.Mapping):
|
|||||||
return hasattr(res, 'handle_%s' % self.CHECK.lower())
|
return hasattr(res, 'handle_%s' % self.CHECK.lower())
|
||||||
|
|
||||||
supported = [is_supported(self, res)
|
supported = [is_supported(self, res)
|
||||||
for res in self.resources.values()]
|
for res in six.itervalues(self.resources)]
|
||||||
|
|
||||||
if not all(supported):
|
if not all(supported):
|
||||||
msg = ". '%s' not fully supported (see resources)" % self.CHECK
|
msg = ". '%s' not fully supported (see resources)" % self.CHECK
|
||||||
@ -866,7 +867,7 @@ class Stack(collections.Mapping):
|
|||||||
if not self.disable_rollback and self.state == (self.ADOPT,
|
if not self.disable_rollback and self.state == (self.ADOPT,
|
||||||
self.FAILED):
|
self.FAILED):
|
||||||
# enter the same flow as abandon and just delete the stack
|
# enter the same flow as abandon and just delete the stack
|
||||||
for res in self.resources.values():
|
for res in six.itervalues(self.resources):
|
||||||
res.abandon_in_progress = True
|
res.abandon_in_progress = True
|
||||||
self.delete(action=self.ROLLBACK, abandon=True)
|
self.delete(action=self.ROLLBACK, abandon=True)
|
||||||
|
|
||||||
@ -1368,7 +1369,7 @@ class Stack(collections.Mapping):
|
|||||||
'status': self.status,
|
'status': self.status,
|
||||||
'template': self.t.t,
|
'template': self.t.t,
|
||||||
'resources': dict((res.name, res.prepare_abandon())
|
'resources': dict((res.name, res.prepare_abandon())
|
||||||
for res in self.resources.values()),
|
for res in six.itervalues(self.resources)),
|
||||||
'project_id': self.tenant_id,
|
'project_id': self.tenant_id,
|
||||||
'stack_user_project_id': self.stack_user_project_id
|
'stack_user_project_id': self.stack_user_project_id
|
||||||
}
|
}
|
||||||
@ -1393,5 +1394,5 @@ class Stack(collections.Mapping):
|
|||||||
return
|
return
|
||||||
# a change in some resource may have side-effects in the attributes
|
# a change in some resource may have side-effects in the attributes
|
||||||
# of other resources, so ensure that attributes are re-calculated
|
# of other resources, so ensure that attributes are re-calculated
|
||||||
for res in self.resources.itervalues():
|
for res in six.itervalues(self.resources):
|
||||||
res.attributes.reset_resolved_values()
|
res.attributes.reset_resolved_values()
|
||||||
|
@ -233,7 +233,7 @@ class Template(collections.Mapping):
|
|||||||
raise exception.InvalidTemplateSection(section=k)
|
raise exception.InvalidTemplateSection(section=k)
|
||||||
|
|
||||||
# check resources
|
# check resources
|
||||||
for res in self[self.RESOURCES].values():
|
for res in six.itervalues(self[self.RESOURCES]):
|
||||||
try:
|
try:
|
||||||
if not res or not res.get('Type'):
|
if not res or not res.get('Type'):
|
||||||
message = _('Each Resource must contain '
|
message = _('Each Resource must contain '
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
from heat.engine import attributes
|
from heat.engine import attributes
|
||||||
from heat.engine import resources
|
from heat.engine import resources
|
||||||
@ -27,9 +28,9 @@ class AttributeSchemaTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def test_all_resource_schemata(self):
|
def test_all_resource_schemata(self):
|
||||||
for resource_type in resources.global_env().get_types():
|
for resource_type in resources.global_env().get_types():
|
||||||
for schema in getattr(resource_type,
|
for schema in six.itervalues(getattr(resource_type,
|
||||||
'attributes_schema',
|
'attributes_schema',
|
||||||
{}).itervalues():
|
{})):
|
||||||
attributes.Schema.from_attribute(schema)
|
attributes.Schema.from_attribute(schema)
|
||||||
|
|
||||||
def test_from_attribute_new_schema_format(self):
|
def test_from_attribute_new_schema_format(self):
|
||||||
|
@ -2598,7 +2598,7 @@ class StackServiceTest(common.HeatTestCase):
|
|||||||
@stack_context('service_resources_list_test_stack_with_depth')
|
@stack_context('service_resources_list_test_stack_with_depth')
|
||||||
def test_stack_resources_list_with_depth(self, mock_load):
|
def test_stack_resources_list_with_depth(self, mock_load):
|
||||||
mock_load.return_value = self.stack
|
mock_load.return_value = self.stack
|
||||||
resources = self.stack.values()
|
resources = six.itervalues(self.stack)
|
||||||
self.stack.iter_resources = mock.Mock(return_value=resources)
|
self.stack.iter_resources = mock.Mock(return_value=resources)
|
||||||
resources = self.eng.list_stack_resources(self.ctx,
|
resources = self.eng.list_stack_resources(self.ctx,
|
||||||
self.stack.identifier(),
|
self.stack.identifier(),
|
||||||
@ -2609,7 +2609,7 @@ class StackServiceTest(common.HeatTestCase):
|
|||||||
@stack_context('service_resources_list_test_stack_with_max_depth')
|
@stack_context('service_resources_list_test_stack_with_max_depth')
|
||||||
def test_stack_resources_list_with_max_depth(self, mock_load):
|
def test_stack_resources_list_with_max_depth(self, mock_load):
|
||||||
mock_load.return_value = self.stack
|
mock_load.return_value = self.stack
|
||||||
resources = self.stack.values()
|
resources = six.itervalues(self.stack)
|
||||||
self.stack.iter_resources = mock.Mock(return_value=resources)
|
self.stack.iter_resources = mock.Mock(return_value=resources)
|
||||||
resources = self.eng.list_stack_resources(self.ctx,
|
resources = self.eng.list_stack_resources(self.ctx,
|
||||||
self.stack.identifier(),
|
self.stack.identifier(),
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
|
import six
|
||||||
|
|
||||||
from heat.common import grouputils
|
from heat.common import grouputils
|
||||||
from heat.common import template_format
|
from heat.common import template_format
|
||||||
@ -61,7 +62,7 @@ class GroupUtilsTest(common.HeatTestCase):
|
|||||||
self.assertEqual(2, grouputils.get_size(group))
|
self.assertEqual(2, grouputils.get_size(group))
|
||||||
|
|
||||||
# member list (sorted)
|
# member list (sorted)
|
||||||
members = [r for r in stack.itervalues()]
|
members = [r for r in six.itervalues(stack)]
|
||||||
expected = sorted(members, key=lambda r: (r.created_time, r.name))
|
expected = sorted(members, key=lambda r: (r.created_time, r.name))
|
||||||
actual = grouputils.get_members(group)
|
actual = grouputils.get_members(group)
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
@ -881,7 +881,7 @@ class HOTemplateTest(common.HeatTestCase):
|
|||||||
empty = template.Template(copy.deepcopy(hot_tpl_empty))
|
empty = template.Template(copy.deepcopy(hot_tpl_empty))
|
||||||
stack = parser.Stack(utils.dummy_context(), 'test_stack', source)
|
stack = parser.Stack(utils.dummy_context(), 'test_stack', source)
|
||||||
|
|
||||||
for defn in source.resource_definitions(stack).values():
|
for defn in six.itervalues(source.resource_definitions(stack)):
|
||||||
empty.add_resource(defn)
|
empty.add_resource(defn)
|
||||||
|
|
||||||
self.assertEqual(hot_tpl['resources'], empty.t['resources'])
|
self.assertEqual(hot_tpl['resources'], empty.t['resources'])
|
||||||
|
@ -138,9 +138,9 @@ class PropertySchemaTest(common.HeatTestCase):
|
|||||||
|
|
||||||
def test_all_resource_schemata(self):
|
def test_all_resource_schemata(self):
|
||||||
for resource_type in resources.global_env().get_types():
|
for resource_type in resources.global_env().get_types():
|
||||||
for schema in getattr(resource_type,
|
for schema in six.itervalues(getattr(resource_type,
|
||||||
'properties_schema',
|
'properties_schema',
|
||||||
{}).itervalues():
|
{})):
|
||||||
properties.Schema.from_legacy(schema)
|
properties.Schema.from_legacy(schema)
|
||||||
|
|
||||||
def test_from_legacy_idempotency(self):
|
def test_from_legacy_idempotency(self):
|
||||||
|
@ -711,7 +711,7 @@ class StackTest(common.HeatTestCase):
|
|||||||
def _mock_check(res):
|
def _mock_check(res):
|
||||||
res.handle_check = mock.Mock()
|
res.handle_check = mock.Mock()
|
||||||
|
|
||||||
[_mock_check(res) for res in self.stack.resources.values()]
|
[_mock_check(res) for res in six.itervalues(self.stack.resources)]
|
||||||
return self.stack
|
return self.stack
|
||||||
|
|
||||||
def test_check_supported(self):
|
def test_check_supported(self):
|
||||||
@ -721,7 +721,7 @@ class StackTest(common.HeatTestCase):
|
|||||||
self.assertEqual(stack1.COMPLETE, stack1.status)
|
self.assertEqual(stack1.COMPLETE, stack1.status)
|
||||||
self.assertEqual(stack1.CHECK, stack1.action)
|
self.assertEqual(stack1.CHECK, stack1.action)
|
||||||
[self.assertTrue(res.handle_check.called)
|
[self.assertTrue(res.handle_check.called)
|
||||||
for res in stack1.resources.values()]
|
for res in six.itervalues(stack1.resources)]
|
||||||
self.assertNotIn('not fully supported', stack1.status_reason)
|
self.assertNotIn('not fully supported', stack1.status_reason)
|
||||||
|
|
||||||
def test_check_not_supported(self):
|
def test_check_not_supported(self):
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from heat.common import template_format
|
from heat.common import template_format
|
||||||
from heat.engine import resource
|
from heat.engine import resource
|
||||||
from heat.engine import stack
|
from heat.engine import stack
|
||||||
@ -173,7 +175,7 @@ class DepAttrsTest(common.HeatTestCase):
|
|||||||
parsed_tmpl = template_format.parse(self.tmpl)
|
parsed_tmpl = template_format.parse(self.tmpl)
|
||||||
self.stack = stack.Stack(self.ctx, 'test_stack',
|
self.stack = stack.Stack(self.ctx, 'test_stack',
|
||||||
template.Template(parsed_tmpl))
|
template.Template(parsed_tmpl))
|
||||||
resources = self.stack.resources.values()
|
resources = six.itervalues(self.stack.resources)
|
||||||
outputs = self.stack.outputs
|
outputs = self.stack.outputs
|
||||||
|
|
||||||
for res in resources:
|
for res in resources:
|
||||||
|
@ -873,7 +873,7 @@ Mappings:
|
|||||||
empty = template.Template(copy.deepcopy(empty_template))
|
empty = template.Template(copy.deepcopy(empty_template))
|
||||||
stk = stack.Stack(self.ctx, 'test_stack', source)
|
stk = stack.Stack(self.ctx, 'test_stack', source)
|
||||||
|
|
||||||
for defn in source.resource_definitions(stk).values():
|
for defn in six.itervalues(source.resource_definitions(stk)):
|
||||||
empty.add_resource(defn)
|
empty.add_resource(defn)
|
||||||
|
|
||||||
self.assertEqual(cfn_tpl['Resources'], empty.t['Resources'])
|
self.assertEqual(cfn_tpl['Resources'], empty.t['Resources'])
|
||||||
|
Loading…
Reference in New Issue
Block a user