diff --git a/fragments/common_functions.sh b/fragments/common_functions.sh index c8191d9..e50c027 100644 --- a/fragments/common_functions.sh +++ b/fragments/common_functions.sh @@ -1,14 +1,25 @@ # Send success status to OpenStack WaitCondition +# or UpdateWaitConditionHandle function notify_success() { - $WC_NOTIFY --data-binary \ - "{\"status\": \"SUCCESS\", \"reason\": \"$1\", \"data\": \"$1\"}" + if [[ "$WC_NOTIFY" =~ ^curl ]]; then + $WC_NOTIFY -k --data-binary \ + "{\"status\": \"SUCCESS\", \"reason\": \"$1\", \"data\": \"$1\"}" + else + /usr/bin/cfn-signal -e 0 -r "$1" -s "SUCCESS" --id "00000" -d "$1" "$WC_NOTIFY" + fi exit 0 } -# Send success status to OpenStack WaitCondition +# Send failure status to OpenStack WaitCondition +# or UpdateWaitConditionHandle function notify_failure() { - $WC_NOTIFY --data-binary \ + if [[ "$WC_NOTIFY" =~ ^curl ]]; then + + $WC_NOTIFY -k --data-binary \ "{\"status\": \"FAILURE\", \"reason\": \"$1\", \"data\": \"$1\"}" + else + /usr/bin/cfn-signal -r "$1" -s "FAILURE" -r "$1" --id "00000" -d "$1" "$WC_NOTIFY" + fi exit 1 } diff --git a/node.yaml b/node.yaml index c69bdad..e0d9291 100644 --- a/node.yaml +++ b/node.yaml @@ -451,7 +451,7 @@ resources: content: str_replace: params: - $WC_NOTIFY: { get_attr: ['wait_handle', 'curl_cli'] } + $WC_NOTIFY: { get_resource: wait_handle } template: {get_file: fragments/common_functions.sh} - path: /usr/local/share/openshift-on-openstack/common_openshift_functions.sh permissions: 0755 @@ -766,7 +766,7 @@ resources: # Provide a curl CLI command to the cloud-init script. Called on completion # to indicate the status of the cloud-init process wait_handle: - type: OS::Heat::WaitConditionHandle + type: OS::Heat::UpdateWaitConditionHandle outputs: hostname: