Ask Your Question
1

Fail Stack Creation if my resource creation fails

asked 2016-08-30 06:53:45 -0500

divinedragon gravatar image

I am creating a resource like below

resources:
  my_server:
    type: OS::Nova::Server
    properties:
        name: ServerHeatTemplate
        image: { get_param: image }
        flavor: { get_param: flavor }
        admin_pass: { get_param: admin_pass }
        networks:
            - network: { get_param : public_net }
        user_data_format: RAW
        user_data:
            str_replace:
                params:
                    __db_root_password__ : { get_param : db_root_password }
                template: |
                    #!/bin/sh

                    echo "DB Password - __db_root_password__" > /tmp/dbpassword.txt

Now, when I create this stack, I see the status of the stack is marked as Create Complete, but my VM is still coming up. Also, this is very naive example, but let's say I wanted to install some packages and they fail to install, I don't want my stack to show that resource provisioning was successful.

Here are my 2 questions:

  • How do I have the stack creation wait for the VM to successfully create and then show status as Create Complete?
  • Is there a way to notify the stack creation process that my VM creation has failed due to my failed packages, and correspondingly mark the stack creation as failed?
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-09-20 11:52:35 -0500

zaneb gravatar image

Use an OS::Heat::WaitCondition resource to wait for the server to boot. You can signal success or failure back to the resource from your user_data script.

edit flag offensive delete link more

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: 2016-08-30 06:53:45 -0500

Seen: 134 times

Last updated: Sep 20 '16