Invalid attribute reference in outputs suppresses all stack-show output

Bug #1273490 reported by Paul Nelson
38
This bug affects 6 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Sergey Kraynev

Bug Description

If an invalid attribute is referenced in the outputs section of a Heat template, the stack can be created with no reported errors, but then "stack-show" will fail.

Example template:

-----
heat_template_version: 2013-05-23

description: |
  A very simple template to demonstrate referencing a bogus attribute

resources:
  compute_instance:
    type: OS::Nova::Server
    properties:
      ...

outputs:
  compute_instance_details:
    value: { get_attr: [compute_instance, some_bogus_attrib]}

-----

In the above example the reference to "some_bogus_attrib" does not get flagged at all until you do something like "heat stack-show...", at which point all stack details are suppressed and one line of output is returned: "The Referenced Attribute (0 some_bogus_attrib) is incorrect."

The problem is twofold:
  * The valid stack details should not be suppressed: I'd still like to see the information that is available
  * It would be more helpful for this error to be raised earlier, say, during the template validation phase; before the stack is even spun up.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

We can definitely resolve static attributes in outputs. Some things aren't possible but attribute schemas can at least be checked.

Changed in heat:
importance: Undecided → Medium
status: New → Triaged
Changed in heat:
assignee: nobody → Sergey Kraynev (skraynev)
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/70358

Changed in heat:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/82486

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.openstack.org/82487

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/82488

Changed in heat:
milestone: none → next
tags: added: icehouse-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to heat (master)

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

commit 85e9411d3def955f34497cffcb2ab2c74915200f
Author: Sergey Kraynev <email address hidden>
Date: Tue Mar 25 02:12:07 2014 -0400

    Initial validation of functions

    All template functions contain only 'result' function for resolving
    snippet of template. Current patch presents initial implementation of
    validate method and support function 'validate' similar to 'resolve'.

    Related-Bug: #1273490
    Change-Id: Id81493bd72e75da746101c4c741eaf846abd8360

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit dfbaf72b27b21f887160c39ea9920fbd1cdd4a16
Author: Sergey Kraynev <email address hidden>
Date: Mon Mar 24 06:21:40 2014 -0400

    Validation functions for resources and outputs

    This patch add ability to validate values in outputs section and also
    validate properties in resource snippets.

    Related-Bug: #1273490
    Change-Id: I9ccb880954751555709bd92f2412cf5606969e70

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

The title of this bug is "Invalid attribute reference in outputs suppresses all stack-show output"

What we need most urgently is a fix for this. Adding validation to get_attr is a longer term thing.

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

Template which demonstrates the issue. Recreated with

[steveb@sbaker-lenovo (master) bds]$ heat stack-create -f bug-1273490.yaml a
+--------------------------------------+------------+--------------------+----------------------+
| id | stack_name | stack_status | creation_time |
+--------------------------------------+------------+--------------------+----------------------+
| f86d22db-7171-4fa0-9d6c-c06cfe777c71 | a | CREATE_IN_PROGRESS | 2014-04-06T21:51:04Z |
+--------------------------------------+------------+--------------------+----------------------+
[steveb@sbaker-lenovo (master) bds]$ heat stack-show a
ERROR: The Referenced Attribute (the_resource some_bogus_attrib) is incorrect.

Fetching an output should catch any exception, set the output value to None and maybe add an error attribute to the output structure to display the validation error string.

tags: removed: icehouse-rc-potential
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/85686

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/85687

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

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

commit 52adf73d4d8eeb614e6cfffaad2c98b69dccd94d
Author: Sergey Kraynev <email address hidden>
Date: Mon Apr 7 04:38:28 2014 -0400

    Catch exception during resolving outputs

    Previously we got error when try to show incorrect outputs.
    Now we catch all exceptions and return None value in this case.

    Change-Id: I7a7c53c1ad8f42082c89c92cbcb52599a6c7f1f8
    Closes-Bug: #1273490

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

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

commit 8530ec7362d90438d154d84dadaec9f1040317dc
Author: Sergey Kraynev <email address hidden>
Date: Mon Apr 7 06:57:14 2014 -0400

    Adding error message for output description

    All caught exceptions should be displayed in output section.

    Change-Id: I217bb52e33c3f0d20c3d01e75326687cc713d90a
    Related-Bug: #1273490

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit 312f331348ca5ec23b2d6316a02ad08331c249d5
Author: Sergey Kraynev <email address hidden>
Date: Mon Mar 24 07:48:34 2014 -0400

    Adding validation algorithm for get attr functions

    Turn on validation for functions Fn::GetAtt and get_attr.
    Validation will be skipped if resource has overwritten FnGetAtt method.

    Related-Bug: #1273490
    Change-Id: I15b6b7447face0cf2fe1d6059d3fb900778b66cc

Thierry Carrez (ttx)
Changed in heat:
milestone: next → none
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to heat (stable/icehouse)

Related fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/135528

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/135529

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/135530

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (stable/icehouse)

Change abandoned by Ethan Lynn (<email address hidden>) on branch: stable/icehouse
Review: https://review.openstack.org/135528

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Ethan Lynn (<email address hidden>) on branch: stable/icehouse
Review: https://review.openstack.org/135529

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Ethan Lynn (<email address hidden>) on branch: stable/icehouse
Review: https://review.openstack.org/135530

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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