Use UUID instead of "00000" for UniqueId

The swarm bay should pass specified "UniqueId" to the resource of
OS::Heat::WaitConditionHandle, but the "UniqueId" is "00000" in
the templates of swarm. So let's use UUID instead of "00000".
In addition, "UniqueID" seems to be obsolete, Use "Id" instead.

Change-Id: I86739db4a2e6faf93d55fe4998bada110de118c6
Closes-Bug: #1606486
This commit is contained in:
PanFengyun 2016-12-16 20:06:48 +08:00
parent d3277af787
commit c489a5d47e
4 changed files with 8 additions and 4 deletions

View File

@ -7,8 +7,9 @@ echo "notifying heat"
STATUS="SUCCESS"
REASON="Setup complete"
DATA="OK"
UUID=`uuidgen`
data=$(echo '{"Status": "'${STATUS}'", "Reason": "'$REASON'", "Data": "'${DATA}'", "UniqueId": "00000"}')
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'" \

View File

@ -11,6 +11,7 @@ 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": "OK", "UniqueId": "00000"}'"'" \
--data-binary "'"'{"Status": "FAILURE", "Reason": "$SERVICE service failed to start.", "Data": "Failure", "Id": "$UUID"}'"'" \
"$WAIT_HANDLE_ENDPOINT"

View File

@ -51,8 +51,9 @@ 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", "UniqueId": "00000"}'"'" \
--data-binary "'"'{"Status": "SUCCESS", "Reason": "Swarm agent ready", "Data": "OK", "Id": "'${UUID}'"}'"'" \
"$WAIT_HANDLE_ENDPOINT"
EOF

View File

@ -36,12 +36,13 @@ END_TLS
fi
UUID=`uuidgen`
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
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", "UniqueId": "00000"}'"'" \\
--data-binary "'"'{"Status": "SUCCESS", "Reason": "Setup complete", "Data": "OK", "Id": "$UUID"}'"'" \\
"$WAIT_HANDLE_ENDPOINT"
[Install]