Skip to content

Commit

Permalink
Replace WaitCondition with UpdateWaitConditio to support host replace…
Browse files Browse the repository at this point in the history
…ment without destroying associated resources. redhat-openstack#369
  • Loading branch information
ioggstream committed Sep 29, 2017
1 parent c98db0f commit 018cc88
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions fragments/common_functions.sh
Original file line number Diff line number Diff line change
@@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 018cc88

Please sign in to comment.