Some output returns null by stack-show, but there's no log hinting what's wrong.

Bug #1482003 reported by Yingzhe Zeng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Triaged
Medium
Kent Wang

Bug Description

1. create a stack with following template:
------------------------------------------------------------------------------
heat_template_version: 2013-05-23
description: create cinder volume

resources:
    res123:
        type: OS::Cinder::Volume
        properties:
            name: volname
            size: 1

outputs:
    voltype:
        value: {get_attr: [res123, volume_type, test]}
------------------------------------------------------------------------------

2. use stack-show to query stack details
The outputs part of details as following:
------------------------------------------------------------------------------
| outputs | [ |
| | { |
| | "output_value": null, |
| | "description": "No description given", |
| | "output_key": "voltype" |
| | } |
| | ]
------------------------------------------------------------------------------
The output_value null is no problem, cause "volume_type" attribute doesn't have key "test",
so select_from_attribute function at heat\engine\attributes.py excepts and returns None.

But there's no log recording exceptions in select_from_attribute according to it's implementation now as following.
------------------------------------------------------------------------------
    try:
        return six.moves.reduce(get_path_component, path, attribute_value)
    except (KeyError, IndexError, TypeError):
        return None
------------------------------------------------------------------------------

Users can't figure out what's going on if they configure path arguments for get_attr wrong by accident like above.
So I suggest adding exception log before return None while exception caught in select_from_attribute.

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

some attributes only appear later in the lifecycle of the resource, so a missing key is not always an error.

Also logging an exception will only be visible to the cloud operator, which is of no use to the heat user.

Until there is a mechanism to send notifications to the user (which will eventually be possible via zaqar) I don't see an easy way of giving the user better feedback that they've mistyped an attribute.

Another possible improvement for those resources which have static attribute schemas (which is most of them) is to flag its attributes schema as strict then raise an error if an attempt is made to get an attribute not in the schema

Changed in heat:
status: New → Triaged
importance: Undecided → Medium
Kent Wang (k.wang)
Changed in heat:
assignee: nobody → Kent Wang (k.wang)
Revision history for this message
Yingzhe Zeng (zengyingzhe) wrote :

Perhaps we could use "output_error".
Raise these exceptions out to "output" function of Stack class.

Revision history for this message
zhaozhilong (zhaozhilong) wrote :

so...
the bug is fixed??or not??

Rico Lin (rico-lin)
Changed in heat:
milestone: none → no-priority-tag-bugs
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.