Use lowercase keys for swarm waitcondition signal
The heat waitcondition signal API accepts status, reason, data and id fields in a JSON object supplied as POST data. Missing fields will be filled with defaults. Previously, the swarm script fragments used a capitalised form of these keys (Status, Reason, Data, Id) which was not being recognised by heat. This caused failures to not be reported. This change uses the correct lowercase names for these fields and also fixes some quoting and incorrect use of UUIDs provided as the id field. Change-Id: I9bfe36e5dd956280eaa42d1c3f1620c4ec27bc0c Closes-Bug: #1504059
This commit is contained in:
parent
3afe70ad80
commit
8d0f25f130
|
@ -9,8 +9,8 @@ REASON="Setup complete"
|
|||
DATA="OK"
|
||||
UUID=`uuidgen`
|
||||
|
||||
data=$(echo '{"Status": "'${STATUS}'", "Reason": "'$REASON'", "Data": "'${DATA}'", "Id": "'$UUID'"}')
|
||||
data=$(echo '{"status": "'${STATUS}'", "reason": "'$REASON'", "data": "'${DATA}'", "id": "'$UUID'"}')
|
||||
|
||||
curl -k -i -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $WAIT_HANDLE_TOKEN" \
|
||||
--data-binary "'$data'" \
|
||||
--data-binary "$data" \
|
||||
"$WAIT_HANDLE_ENDPOINT"
|
||||
|
|
|
@ -11,7 +11,6 @@ write_files:
|
|||
[Service]
|
||||
Type=simple
|
||||
TimeoutStartSec=0
|
||||
UUID=`uuidgen`
|
||||
ExecStart=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \
|
||||
--data-binary "'"'{"Status": "FAILURE", "Reason": "$SERVICE service failed to start.", "Data": "Failure", "Id": "$UUID"}'"'" \
|
||||
--data-binary '{"status": "FAILURE", "reason": "$SERVICE service failed to start.", "data": "Failure"}' \
|
||||
"$WAIT_HANDLE_ENDPOINT"
|
||||
|
|
|
@ -67,6 +67,7 @@ chmod 644 $CONF_FILE
|
|||
|
||||
SCRIPT=/usr/local/bin/notify-heat
|
||||
|
||||
UUID=`uuidgen`
|
||||
cat > $SCRIPT << EOF
|
||||
#!/bin/sh
|
||||
until etcdctl \
|
||||
|
@ -79,9 +80,8 @@ do
|
|||
sleep 5
|
||||
done
|
||||
|
||||
UUID=`uuidgen`
|
||||
curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \
|
||||
--data-binary "'"'{"Status": "SUCCESS", "Reason": "Swarm agent ready", "Data": "OK", "Id": "'${UUID}'"}'"'" \
|
||||
--data-binary '{"status": "SUCCESS", "reason": "Swarm agent ready", "data": "OK", "id": "${UUID}"}' \
|
||||
"$WAIT_HANDLE_ENDPOINT"
|
||||
EOF
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ cat >> /etc/systemd/system/swarm-manager.service << END_SERVICE_BOTTOM
|
|||
ExecStop=/usr/bin/docker stop swarm-manager
|
||||
Restart=always
|
||||
ExecStartPost=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \\
|
||||
--data-binary "'"'{"Status": "SUCCESS", "Reason": "Setup complete", "Data": "OK", "Id": "$UUID"}'"'" \\
|
||||
--data-binary '{"status": "SUCCESS", "reason": "Setup complete", "data": "OK", "id": "$UUID"}' \\
|
||||
"$WAIT_HANDLE_ENDPOINT"
|
||||
|
||||
[Install]
|
||||
|
|
Loading…
Reference in New Issue