YAML template with empty sections

Bug #1312114 reported by Sergey Kraynev
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Undecided
Sergey Kraynev

Bug Description

When I try to create stack using yaml template:

heat_template_version: 2013-05-23
description: >
  A very simple template
parameters:
resources:
  compute_instance:
    type: OS::Nova::Server
    properties:
        name: Hello1
        key_name : heat_key
        image : fedora-20.x86_64
        flavor: m1.small
outputs:
  compute_instance_details:
    value: { get_attr: [compute_instance, networks]}

I get error: "ERROR: 'NoneType' object has no attribute 'iteritems' "
Same behavior you could get, when use template with empty resources or outputs sections (such as parameters in current example).

In other side JSON gives a ability to create such stack (it works without any error):

{
  "AWSTemplateFormatVersion" : "2010-09-09",
  "Parameters" : {
  },
  "Resources" : {
  },
  "Outputs": {
  }
}

The cause of problem is:
yaml create dictionary with key "parameters" ("resources", "outputs") and value None.
Existing code catches situation only when section is absent and does not handle example above.

Changed in heat:
assignee: nobody → Sergey Kraynev (skraynev)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to heat (master)

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

Changed in heat:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to heat (master)

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

commit de2ecff5fd6228f89583955c7e5c42f6a65e9eca
Author: Sergey Kraynev <email address hidden>
Date: Thu Apr 24 06:11:40 2014 -0400

    Allow empty sections in the yaml templates

    Existing check for absent sections in template is not enough for
    handling situation with empty content.
    Current patch improves using default value for parameters, resources and
    outputs sections in yaml templates.

    Change-Id: I94b572bf5f5b1593276616d9d0a84386dd12b8fe
    Closes-Bug: #1312114

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-1 → 2014.2
Revision history for this message
Thiago Martins (martinx) wrote :

I have a stack yaml template that works in Juno, but not on IceHouse.

It triggers this error.

Revision history for this message
Steve Baker (steve-stevebaker) wrote :

does it help if you specify the following?

parameters:{}

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.