Ask Your Question
1

heat stack output-show return null

asked 2014-12-11 09:50:27 -0500

ZJ gravatar image

updated 2015-02-04 03:56:16 -0500

Hi,

I'm using SoftwareConfig and SoftwareDeployment in my heat scripts. I have problem with values returned by command "heat output-show <stack_name> <output_name>."

I want just receive stdout, stderr and return code from command which I execute. All is working fine when I execute bash script but when I put python script in SoftwareConfig resource (as config, group is script) all mentioned outputs are set to "null".

The interesting thing is that in "heat event-list" output returned error is visible:

| deployment | 93c7ba66-6043-43d7-ada7-49106ef6b7cc | Error: Deployment to server failed: deploy_status_code : Deployment exited with non-zero status code: 1 | CREATE_FAILED | 2014-12-11T13:21:04Z |

I'm adding additional information below.

I made tests with many heat templates but always in case of script error outputs are "null". One of the simplest template which I saw this problem:

heat_template_version: 2014-10-16

resources:
  server:
    type: OS::Nova::Server
    properties:
       availability_zone: CMS01
       flavor: m1.medium
       image:  rhel_image
       name: deployment test
       networks:
           - network: e107ff70-3e4f-401f-bcf8-376990e754ae
       user_data_format: SOFTWARE_CONFIG

  config:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      config:
          get_file: python_script

  deployment:
    type: OS::Heat::SoftwareDeployment
    properties:
      actions: [ "CREATE" ]
      config: { get_resource: config }
      server: { get_resource: server }
      signal_transport: HEAT_SIGNAL

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

My python_script (again really simple):

  • first version with success (outputs contains expected informations)
#!/usr/bin/env python

import os
import sys

with open("/var/tmp/test_py.out" ,"w") as f:

      f.write("TEST SOFTWARE DEPLOYMENT OUTPUTS")

print "TEST OUTPUTS"

sys.exit(0)
  • now with failure (I just changed last line to:

sys.exit(1)

Results:

Success:

deployment    | a52330aa-d015-45eb-a278-9cc6b7c3f7d1 | OS::Heat::SoftwareDeployment | CREATE_COMPLETE | 2015-02-04T07:47:12Z

MariaDB [heat]> select output_values from software_deployment where id="a52330aa-d015-45eb-a278-9cc6b7c3f7d1"
    -> ;
+-----------------------------------------------------------------------------------+ | output_values                        |
+-----------------------------------------------------------------------------------+ | {"deploy_stdout": "TEST OUTPUTS\n", "deploy_stderr": "", "deploy_status_code": 0} |
+-----------------------------------------------------------------------------------+

    [root@01 test_templates(ip)]# heat output-show test_deployment status_code 
    0 
    [root@01 test_templates(ip)]# heat output-show test_deployment stderr 
    "" 
    [root@01 test_templates(ip)]# heat output-show test_deployment stdout 
    "TEST OUTPUTS\n"

Failure

deployment    | 3f5f39a4-1d00-43b2-be57-1d2e5a102a21 | OS::Heat::SoftwareDeployment | CREATE_FAILED   | 2015-02-04T08:07:44Z

MariaDB [heat]> select output_values from software_deployment where id="3f5f39a4-1d00-43b2-be57-1d2e5a102a21"
    -> ;
+-----------------------------------------------------------------------------------+ | output_values                        |
+-----------------------------------------------------------------------------------+ | {"deploy_stdout": "TEST OUTPUTS\n", "deploy_stderr": "", "deploy_status_code": 1} |
+-----------------------------------------------------------------------------------+

[root@open-gen8vcms01 test_templates(ip)]# heat output-list test_deployment_failure
+-------------+----------------------+ | output_key  | description          |
+-------------+----------------------+ | status_code | No description given | | stderr      | No description given | | stdout      | No description given |
+-------------+----------------------+ 


   [root@open-gen8vcms01 test_templates(ip)]# heat output-show test_deployment_failure status_code 
null 
    [root@open-gen8vcms01 test_templates(ip)]# heat output-show test_deployment_failure stderr 
null 
    [root@open-gen8vcms01 test_templates(ip)]# heat output-show test_deployment_failure stdout 
null
edit retag flag offensive close merge delete

Comments

1

Looks weird! Have you tried running the script manually after logging into the instance? Post back the results/outcome to take this further!

unmesh-gurjar gravatar imageunmesh-gurjar ( 2014-12-22 05:53:35 -0500 )edit

Yes I tried execute it manually, it works good (if fails it provides error return code, if successful it receives '0' as expected). The only problem is that "null" is visible in heat output-show.

I did few additional tests and noticed that "null" is visible only when script fails.

ZJ gravatar imageZJ ( 2014-12-22 06:52:47 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-02-02 15:56:25 -0500

Steve Baker gravatar image

See this answer for hints on debugging software deployments.

Also take a look at the official hot-guide software-deployment section.

edit flag offensive delete link more

Comments

The problem occurs only when script fails (Juno 2014.1). I see returned output, errors and status_code in mysql DB (in software_deployment table) so it seems that problem is with "heat output-show".

ZJ gravatar imageZJ ( 2015-02-03 07:06:18 -0500 )edit

Could you post the template? (especially the deployment resources, and the outputs section)

Steve Baker gravatar imageSteve Baker ( 2015-02-03 14:19:25 -0500 )edit

I updated my original post with additional information. I'm working on Juno 2014.1.

ZJ gravatar imageZJ ( 2015-02-04 03:58:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2014-12-11 09:50:27 -0500

Seen: 1,674 times

Last updated: Feb 04 '15