create stack api

asked 2014-12-23 11:42:54 -0500

adam__ gravatar image

I'm trying to create a stack using the orchestration API as referenced here. The particular method I'm calling is the POST to /v1/​{tenant_id}​/stacks.

I do not have trouble making POST requests in other parts of the API, and I am able to perform GETs to other methods in the orchestration API. However I repeatedly get 400 Bad Request as a response for the create stack method.

I am providing the stack_name parameter always. And I have tried using the template_url parameter, and pointing to a networked web server file (which is accessible to the service) which looks like this:

heat_template_version: 2013-05-23

    type: "OS::Nova::Server"
      flavor: m1.medium
      image: Ubuntu3
      name: test-wp-automated
      - network: 8603a548-d019-4ef1-b286-2898acff7d24
      user_data_format: RAW
      user_data: |
        final_message: "The system is finally up after $UPTIME seconds"

    description: Public IP...
    value: { get_attr: [compute_instance, first_address] }

Also I have tried just providing the template parameter with JSON which looks similar to below:


However also with this I get a 400 response. Any ideas reason as to why these aren't working I would appreciate very much!

edit retag flag offensive close merge delete


can you provide logs.

rishi gravatar imagerishi ( 2014-12-24 01:15:06 -0500 )edit

Unfortunately - I can't at the moment! I don't have access to the environment and the person who does is on holiday. Is there nothing that can be gleaned from the information provided? Am I doing anything obviously wrong?

adam__ gravatar imageadam__ ( 2014-12-24 04:07:59 -0500 )edit

Template seems fine to me. I would suggest you try creating stack using CLI with debug option, providing exactly the same parameters. The request body in debug logs might help you debug further!

unmesh-gurjar gravatar imageunmesh-gurjar ( 2014-12-29 09:57:54 -0500 )edit

Thank you both for your help. I am now able to create VMs via the API. It turns out that I should have specified the ImageID in the Image field. I made the assumption I could use the name as that seems to work for other API calls - but that was my mistake!

adam__ gravatar imageadam__ ( 2015-01-02 07:07:51 -0500 )edit

@Adam: What version of heat engine did you get this error on? It looks like a bug, because as per the documentation, the image property of OS::Nova::Server resource accepts ID or name of the image.

unmesh-gurjar gravatar imageunmesh-gurjar ( 2015-01-05 06:09:08 -0500 )edit