can't list outputs when stack create failed

Bug #1333208 reported by Victor HU
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Victor HU

Bug Description

I'm trying to create a stack with software deployed on the vm. The template is like:

heat_template_version: 2013-05-23

resources:
  testconfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config: |
        #!/bin/sh
        #...... do sth ......
        service xxxx restart #this line will cause an error

  testdeploy:
    type: OS::Heat::SoftwareDeployment
    properties:
      server: {get_resource: testserver}
      config: {get_resource: testconfig}
      actions: ['CREATE','UPDATE']

  testserver:
    type: OS::Nova::Server
    properties:
      image: fedora_software_config
      flavor: m1.small
      key_name: heat_key
      user_data_format: SOFTWARE_CONFIG

outputs:
  result:
    value:
      get_attr: [testdeploy, result]
  stdout:
    value:
      get_attr: [testdeploy, deploy_stdout]
  stderr:
    value:
      get_attr: [testdeploy, deploy_stderr]
  status_code:
    value:
      get_attr: [testdeploy, deploy_status_code]

Due to the script error which I didn't noticed at first, the stack create failed. I wanted to check 'stdout' and 'stderr' defined in outputs to find out the reason. So I tried to use 'output-list' and 'output-show', but these two commands returned nothing.

I looked into the code and I found engine only shows outputs for stacks with COMPLETE status.

[1]https://github.com/openstack/heat/blob/master/heat/engine/api.py#L108
[2]https://github.com/openstack/heat/blob/master/heat/engine/cfn/functions.py#L180

I wonder why viewing outputs of FAILED stack is forbidden. I think outputs like 'stderr' is designed for debugging FAILED stacks. It's reasonable to allow users to view these outputs when the stack is FAILED in this condition.

I changed the if clause in [1] and [2]. 'output-list' and 'output-show' works well with the template above. But what troubles me is that in some other conditions allow users to view outputs of FAILED stack is not a good idea. I use template below to create a stack:

heat_template_version: 2013-05-23

resources:
  testserver:
    type: OS::Nova::Server
    properties:
      image: fedora_software_config
      flavor: m1.xxxx #this line will cause an error

outputs:
  ipaddr:
    value:
      get_attr: [testserver, first_address]

After creation failed, I use 'output-show' to view 'ipaddr'. I noticed the engine made a query for the address. But the query is unnecessary and may cause some problem. So I wonder whether we should make changes for every resource to determine which output is allowed for users to view or change the method how they're get when the stack status is FAILED or just leave it as it was.

opinions?

Victor HU (huruifeng)
Changed in heat:
assignee: nobody → Victor HU (huruifeng)
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

As a matter of interest, is there a useful message in the stack event for the failed deployment resource?

Revision history for this message
Victor HU (huruifeng) wrote :

Yes there is, but not sufficent. By using 'event-list' and 'resource-show' I have 'deployment failed (6)' or 'deploy_status_code 6' in 'resource_status_reason' field, but no more details.

Victor HU (huruifeng)
information type: Public → Public Security
information type: Public Security → Public
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/106298

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/106298
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=a918612cc11ab4ecf773c05352823fa96af061a4
Submitter: Jenkins
Branch: master

commit a918612cc11ab4ecf773c05352823fa96af061a4
Author: Victor HU <email address hidden>
Date: Fri Jul 11 08:01:25 2014 +0000

    Allow user to view outputs of failed stacks

    Outputs like 'stderr' are designed for users to debug failed stacks, if
    users can not view outputs of failed stacks, they can not get the error
    messages.

    Change-Id: I1b2b4f0e967695cf3297d93022cecec958e94b24
    Closes-Bug: #1333208

Changed in heat:
status: In Progress → Fix Committed
Steven Hardy (shardy)
Changed in heat:
milestone: none → juno-2
importance: Undecided → Medium
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: juno-2 → 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.