2014-03-31 25 views
3

我有一个OpenStack Heat模板,它很大程度上借鉴了CloudFormation参数,这就是我添加CF标签的原因。等待条件Heat/CloudFormation和实例启动顺序

我的模板包含两个应以特定顺序启动(或至少通过用户数据配置)的实例。我以为我会用WaitCondition来实现这一目标,但看起来他并没有完全工作,或者至少没有达到我期望的水平。

这里有一个片段:

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] 

目前摞正确卡住而热火没有收到卷曲信号反馈,这是正确的“创建进度”状态。问题是一旦堆栈启动并且配置自动运行,就会创建'second'实例。

我在第二个实例中增加了一个depends_on,但它看起来没有任何效果(或者再次,不是我认为的效果)。

是否可以使用Heat/Cloud Formation来执行此实例启动顺序配置?我错过了什么?

谢谢!

回答

3

this这里给出的博客和他已经给你的问题提供了正确的解释。因为这个功能实际上不起作用。有一个你可以利用的解决方法。

1

我完全不熟悉Heat模板,但立即脱颖而出的是你的curl命令。

变化curl命令

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

我有各种各样的信号AWS有什么表面上是JSON的问题,但不接受内容类型的标题:应用程序/ JSON