문제

I have a OpenStack Heat template which borrows heavily from the CloudFormation parameters, which is why I added the CF tag.

My template contains two instances which should be started (or at least configured through user-data) in a specific order. I thought I would use WaitCondition to make that happen but it looks like he doesn't fully work, or at least doesn't do what I expect.

Here's a snippet:

resources:
  first:
    type: OS::Nova::Server
    properties:
      key_name: { get_param: key_name }
      image: fedora19
      flavor: { get_param: instance_type }
      user_data:
        str_replace:
          template: |
              #!/bin/bash
              [configuration code here]
              curl -X PUT -H 'Content-Type:application/json' -d '{"Status" : "SUCCES", "Data" : "Application has completed configuration."}' "$wait_handle$"
          params:
            $wait_handle$: {get_resource: my_wait_handle}

  first_wait_handle:
    type: AWS::CloudFormation::WaitConditionHandle

  first_wait:
    type: AWS::CloudFormation::WaitCondition
    depends_on: first
    properties:
      Handle:
    get_resource: first_wait_handle
      Timeout: 1000

second:
    type: OS::Nova::Server
    depends_on: first_wait
    properties:
      key_name: { get_param: key_name }
      image: fedora19
      flavor: { get_param: instance_type }
      user_data: |
        #!/bin/bash
        [configuration code 2]

Currently the stack is correctly stuck on "create in progress" state while Heat hasn't received the curl signal back, which is correct. Problem is that the 'second' instance is created as soon as the stack is launched and configuration runs automatically.

I added a depends_on in the second instance but it looks like it has no effect (or, again, not the effect I thought).

Is it possible to do this instance startup order configuration with Heat/Cloud Formation? What am I missing?

Thanks!

도움이 되었습니까?

해결책

Read this blog given here and he has given a correct explanation to your question. Because this functionality doesn't actually works. There is a work-around which you can make use of.

다른 팁

I'm not at all familiar with Heat templates, but the thing that immediately stood out is your curl command.

Change the curl command

curl -X PUT -H 'Content-Type:' --data-binary '{"Status" : ....

I've had all sorts of problems signalling AWS with what's ostensibly JSON but doesn't accept a header with content-type: application/json

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top