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:
Mark Goddard 2017-05-24 14:23:32 +01:00
parent 012696943a
commit dad5b6340a
4 changed files with 5 additions and 5 deletions

View File

@ -8,8 +8,8 @@ STATUS="SUCCESS"
REASON="Setup complete"
DATA="OK"
data=$(echo '{"Status": "'${STATUS}'", "Reason": "'$REASON'", "Data": "'${DATA}'", "UniqueId": "00000"}')
data=$(echo '{"status": "'${STATUS}'", "reason": "'$REASON'", "data": "'${DATA}'", "id": "000000"}')
curl -i -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $WAIT_HANDLE_TOKEN" \
--data-binary "'$data'" \
--data-binary "$data" \
"$WAIT_HANDLE_ENDPOINT"

View File

@ -12,5 +12,5 @@ write_files:
Type=simple
TimeoutStartSec=0
ExecStart=/usr/bin/curl -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": "OK", "UniqueId": "00000"}'"'" \
--data-binary '{"status": "FAILURE", "reason": "$SERVICE service failed to start.", "data": "Failure", "id": "00000"}' \
"$WAIT_HANDLE_ENDPOINT"

View File

@ -51,7 +51,7 @@ do
done
curl -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", "UniqueId": "00000"}'"'" \
--data-binary '{"status": "SUCCESS", "reason": "Swarm agent ready", "data": "OK", "id": "00000"}' \
"$WAIT_HANDLE_ENDPOINT"
EOF

View File

@ -39,7 +39,7 @@ cat >> /etc/systemd/system/swarm-manager.service << END_SERVICE_BOTTOM
etcd://$ETCD_SERVER_IP:2379/v2/keys/swarm/
ExecStop=/usr/bin/docker stop swarm-manager
ExecStartPost=/usr/bin/curl -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \\
--data-binary "'"'{"Status": "SUCCESS", "Reason": "Setup complete", "Data": "OK", "UniqueId": "00000"}'"'" \\
--data-binary '{"status": "SUCCESS", "reason": "Setup complete", "data": "OK", "id": "00000"}' \\
"$WAIT_HANDLE_ENDPOINT"
[Install]