From 0bd3fa87d6bfe857acb67fbfb97270a218da74a6 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Thu, 15 May 2014 13:34:32 -0700 Subject: [PATCH] Error out when complete waitcondition fails When we curl to the complete waitcondition url we don't consider heat returning an error as reason to exit with error. This prevents us from attempting to re-run the configuration and thus we never signal heat again. Change-Id: I915825d76ec889bc09b81ad93f70b34d909262b0 Closes-bug: #1306294 --- .../post-configure.d/99-refresh-completed | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/elements/os-refresh-config/os-refresh-config/post-configure.d/99-refresh-completed b/elements/os-refresh-config/os-refresh-config/post-configure.d/99-refresh-completed index a1f685995..f7b6958dd 100755 --- a/elements/os-refresh-config/os-refresh-config/post-configure.d/99-refresh-completed +++ b/elements/os-refresh-config/os-refresh-config/post-configure.d/99-refresh-completed @@ -10,7 +10,13 @@ ID=$(os-apply-config --key instance-id --type raw --key-default "") call_curl() { local method=$1 local url=$2 - curl -X $method -H 'Content-Type:' --data-binary "{\"Status\" : \"SUCCESS\",\"Reason\" : \"Configuration Complete\",\"UniqueId\" : \"$ID\",\"Data\" : \"Finished os-refresh-config.\"}" $url + local output=$(mktemp) + status=$(curl -s -w %{http_code} -X $method -H 'Content-Type:' -o $output --data-binary "{\"Status\" : \"SUCCESS\",\"Reason\" : \"Configuration Complete\",\"UniqueId\" : \"$ID\",\"Data\" : \"Finished os-refresh-config.\"}" $url) + cat $output + rm $output + if [ "$status" != "200" ]; then + exit 1 + fi } # Signals use POST, wait handles use PUT