From 0ef126eed45eba72f8527ce6520ca91c88bd8230 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Fri, 21 Apr 2017 11:58:06 +0000 Subject: [PATCH] Revert "Generate placeholders for resource proxies before validation" This reverts commit f94d76cb322f14a001e7990c0918a67f1a09ea16. All stack deployments in TripleO are taking about 10 minutes longer, so 20 minutes for ovb-updates job. We found out that it's partially related to this patch. See details in the bug report. https://bugs.launchpad.net/tripleo/+bug/1684272 Change-Id: I80ced2dbc9127bc1501f8729eb52195c0d206813 Partial-Bug: #1684272 --- heat/engine/resource.py | 15 ++++----------- heat/engine/stack.py | 9 ++++----- heat/tests/engine/test_check_resource.py | 2 -- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/heat/engine/resource.py b/heat/engine/resource.py index f10c13926d..e077fd60c8 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -871,17 +871,10 @@ class Resource(status.ResourceStatus): def get_attrs(attrs): for attr in attrs: path = (attr,) if isinstance(attr, six.string_types) else attr - if self.action == self.INIT: - if (type(self).get_attribute != Resource.get_attribute or - type(self).FnGetAtt != Resource.FnGetAtt or - path[0] in self.attributes): - # TODO(ricolin) make better placeholder values here - yield path, None - else: - try: - yield attr, self.get_attribute(*path) - except exception.InvalidTemplateAttribute as ita: - LOG.info('%s', ita) + try: + yield attr, self.get_attribute(*path) + except exception.InvalidTemplateAttribute as ita: + LOG.info('%s', ita) dep_attrs = set(self.stack.get_dep_attrs( six.itervalues(self.stack.resources), diff --git a/heat/engine/stack.py b/heat/engine/stack.py index a07cea7e5a..f89cfc9f43 100644 --- a/heat/engine/stack.py +++ b/heat/engine/stack.py @@ -839,11 +839,10 @@ class Stack(collections.Mapping): raise exception.StackValidationFailed( message=_("Duplicate names %s") % dup_names) - iter_rsc = (self.dependencies if validate_by_deps - else six.itervalues(resources)) - - for name, res in six.iteritems(resources): - stk_defn.update_resource_data(self.defn, name, res.node_data()) + if validate_by_deps: + iter_rsc = self.dependencies + else: + iter_rsc = six.itervalues(resources) unique_defns = set(res.t for res in six.itervalues(resources)) unique_defn_names = set(defn.name for defn in unique_defns) diff --git a/heat/tests/engine/test_check_resource.py b/heat/tests/engine/test_check_resource.py index ea92152073..09d59bf600 100644 --- a/heat/tests/engine/test_check_resource.py +++ b/heat/tests/engine/test_check_resource.py @@ -604,7 +604,6 @@ class MiscMethodsTest(common.HeatTestCase): self.resource = self.stack['A'] def test_node_data_ok(self): - self.resource.action = self.resource.CREATE expected_input_data = {'attrs': {(u'flat_dict', u'key2'): 'val2', (u'flat_dict', u'key3'): 'val3', (u'nested_dict', u'dict', u'a'): 1, @@ -619,7 +618,6 @@ class MiscMethodsTest(common.HeatTestCase): self.assertEqual(expected_input_data, actual_input_data.as_dict()) def test_node_data_exception(self): - self.resource.action = self.resource.CREATE expected_input_data = {'attrs': {}, 'id': mock.ANY, 'reference_id': 'A',