Swift信号资源使用云编译用户数据脚本

导 言

云编程用户可应用Swift信号资源帮助判定用户数据脚本状况执行Swift信号资源增加功能表示用户数据脚本完成与否,如果完成,则表示成功或失败

使用OS::Heat::SwiftSignal资源协调资源生成信号来自栈外部或内部源资源常与OS::Heat::SwiftSignalHandle资源库

使用SwiftSignalHandle资源创建临时URL应用脚本发送信号上头Swift信号资源等待该URL接收数定数余信定时内信号华体会联盟hth临时URL使用racspace云创建
文件整理

后续教程引导你经历单节点Linux服务器构建过程,该服务器信号成败用户数据脚本执行

添加顶级模板段

顶部模板添加以下信息:

template_version:2014-10-16描述:资源:输出

添加 SwiftSignalHandle资源库

资源节中增加SwiftSignalHandle资源库下代码示例显示如何添加此资源

信号-handle:类型:OS:Heat:SwiftSignalHandle

添加 Swift信号资源库

资源节中增加Swift信号资源库

提供 URL控件属性和信号数计数属性

下示例显示如何添加Swift信号资源等待600秒接收信号控件.

wait_on_server:类型OS:Heat:SwiftSignal属性

栈标记为故障超时属性或非信号余信接收数据字符串和推理字符串可附加成败通知数据串是一个属性,可显示为模板输出

添加服务器资源

添加Linux服务器内用户数据属性,包括块脚本脚本执行尾端发送余信费城消息传递到临时URLSwiftSignalHandle资源,你
前面加法

linux_server:   type: OS::Nova::Server   properties:     image: 4b14a92e-84c8-4770-9245-91ecb8501cc2     flavor: 1 GB Performance     user_data:       str_replace:         template: |           #!/bin/bash -x           # assume you are doing a long-running operation here           sleep 300            # Assuming the long-running operation completed successfully,           # notify success signal           wc_notify --data-binary '{"status": "SUCCESS", "data": "Script execution succeeded"}'            # Alternatively, if operation fails, a FAILURE with reason and data may be sent,           # notify failure signal example below           # wc_notify --data-binary '{"status": "FAILURE", "reason":"Operation failed due to xyz error", "data":"Script execution failed"}'          params:           # Replace all occurrences of "wc_notify" in the script with an           # appropriate curl PUT request using the "curl_cli" attribute           # of the SwiftSignalHandle resource           wc_notify: { get_attr: ['signal_handle', 'curl_cli']

添加Swift信号URL 输出段内

下示例显示如何向鼠标添加Swift信号URL输出段数 :

# 获取信号 URL中包含传递到信号句sesse_url:值 { get_atr:[sit_handle,curl_cli]}描述 Swift信号 URL#获取描述脚本结果的数据NULL信号data:值 { get_atr:[sit_onserver','dad'}描述:数据描述脚本结果#获取IPv4服务器地址_public_ip:值 { get_atr:[linux_server访问IP4]}描述:Linux服务器公共IP

视图全模板

下代码显示完整模板长像 :

template_version:2014-10-16描述:#单节点liux服务器快速信号resources:    signal_handle:     type: "OS::Heat::SwiftSignalHandle"    wait_on_server:     type: OS::Heat::SwiftSignal     properties:       handle: {get_resource: signal_handle}       count: 1       timeout: 600    linux_server:     type: OS::Nova::Server     properties:       image: 4b14a92e-84c8-4770-9245-91ecb8501cc2       flavor: 1 GB Performance       user_data:         str_replace:           template: |             #!/bin/bash -x             # assume you are doing a long-running operation here             sleep 300              # Assuming long-running operation completed successfully, notify success signal             wc_notify --data-binary '{"status": "SUCCESS", "data": "Script execution succeeded"}'              # Alternatively, if operation fails, a FAILURE with reason and data may be sent,             # notify failure signal example below             # wc_notify --data-binary '{"status": "FAILURE", "reason":"Operation failed due to xyz error", "data":"Script execution failed"}'            params:             wc_notify: { get_attr: ['signal_handle', 'curl_cli'] }  outputs:   # Get the signal URL which contains all information passed to the signal handle   signal_url:     value: { get_attr: ['signal_handle', 'curl_cli'] }     description: Swift signal URL    # Obtain data describing script results.NULL信号data:值 {get_atr:swait_onserserver,data}描述:数据描述脚本结果#获取IPv4服务器地址_public_ip:值 {get_atr:servers

Baidu
map