Stack preview fails for scaling groups with Template version was not provided

Bug #1351005 reported by William C. Arnold
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
William C. Arnold

Bug Description

Exception logged in screen-h-api.log is
2014-07-31 19:10:54.162 29106 WARNING oslo.messaging._drivers.amqpdriver [req-9e945e84-c08d-4ebe-b573-42a547925a42 ] No calling threads waiting for msg_id : 83c7257b7e1544cabe13a4ca1aca62fc, message : {u\
'_unique_id': u'ae2b95e1d8bf4ef6bd5ed790e87e4a97', u'failure': u'{"args": [], "module": "heat.common.exception", "kwargs": {"explanation": "Template version was not provided"}, "message": "The template v\
ersion is invalid: Template version was not provided", "tb": ["Traceback (most recent call last):\\n", " File \\"/opt/stack/heat/heat/engine/service.py\\", line 63, in wrapped\\n return func(self, ct\
x, *args, **kwargs)\\n", " File \\"/opt/stack/heat/heat/engine/service.py\\", line 539, in preview_stack\\n return api.format_stack_preview(stack)\\n", " File \\"/opt/stack/heat/heat/engine/api.py\\\
", line 169, in format_stack_preview\\n fmt_resources = map(format_resource, stack.preview_resources())\\n", " File \\"/opt/stack/heat/heat/engine/stack.py\\", line 509, in preview_resources\\n fo\
r resource in self.resources.itervalues()]\\n", " File \\"/opt/stack/heat/heat/engine/stack_resource.py\\", line 102, in preview\\n template = parser.Template(self.child_template())\\n", " File \\"/\
opt/stack/heat/heat/engine/template.py\\", line 121, in __new__\\n TemplateClass = get_template_class(cls._plugins, template)\\n", " File \\"/opt/stack/heat/heat/engine/template.py\\", line 90, in ge\
t_template_class\\n version = get_version(template_data, available_versions)\\n", " File \\"/opt/stack/heat/heat/engine/template.py\\", line 73, in get_version\\n explanation = _(\'Template versio\
n was not provided\')\\n", "InvalidTemplateVersion: The template version is invalid: Template version was not provided\\n"], "class": "InvalidTemplateVersion"}', u'result': None}

The immediate cause appears to be that heat/engine/template.py, method get_version(template_data, available_versions):
when operating on the the nested stack, is being passed a heat.engine.cfn.template.CfnTemplate for template_data when it expect a dict.

Revision history for this message
William C. Arnold (barnold-8) wrote :

The following (crude) patch works and causes no obvious problems. Will submit as a patch to gerrit.
diff --git a/heat/engine/template.py b/heat/engine/template.py
index c26bebe..e1d26a1 100644
--- a/heat/engine/template.py
+++ b/heat/engine/template.py
@@ -56,6 +56,8 @@ class TemplatePluginManager(object):

 def get_version(template_data, available_versions):
+ if isinstance(template_data, Template):
+ template_data = template_data.t
     version_keys = set(key for key, version in available_versions)
     candidate_keys = set(k for k, v in template_data.iteritems() if
                          isinstance(v, basestring))

Revision history for this message
William C. Arnold (barnold-8) wrote :

To replicate using a template found in heat-templates
[x]:~/heat-templates$ heat stack-preview -f cfn/F17/InstanceGroup.template IG -P KeyName=mykey
ERROR: The template version is invalid: Template version was not provided

(With a 2014/08/01 devstack install.)

Changed in heat:
assignee: nobody → William C. Arnold (barnold-8)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/111348

Changed in heat:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/111348
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=0fc185a962cbde1f5cb0de0fda8c4b15c2ba5eac
Submitter: Jenkins
Branch: master

commit 0fc185a962cbde1f5cb0de0fda8c4b15c2ba5eac
Author: Bill Arnold <email address hidden>
Date: Tue Aug 12 09:12:12 2014 -0400

    Template get_version breaks with Template object

    The get_version method on template expects a dict, breaking
    stack preview. This patch modifies StackResource preview
    to always call the Template constructor with a dict

    Change-Id: I6e75a78b4d496e235f11ec3d94ee58a069ab5336
    Closes-bug: #1351005

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-3 → 2014.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.