summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2017-05-24 14:23:32 +0100
committerMark Goddard <mark@stackhpc.com>2017-06-16 14:29:21 +0100
commit8d0f25f130ccb645c51ee080c49971b7816b8e80 (patch)
tree65dbab19d34296c1fb1d49b2bdd955e10c2c11d8
parent3afe70ad80d19ed3079fc48bdddcaf65011c48de (diff)
Use lowercase keys for swarm waitcondition signalstable/ocata
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
Notes
Notes (review): Code-Review+2: Spyros Trigazis (strigazi) <strigazi@gmail.com> Code-Review+2: yatin <ykarel@redhat.com> Workflow+1: yatin <ykarel@redhat.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Sat, 17 Jun 2017 21:07:57 +0000 Reviewed-on: https://review.openstack.org/474972 Project: openstack/magnum Branch: refs/heads/stable/ocata
-rw-r--r--magnum/drivers/common/templates/swarm/fragments/cfn-signal.sh4
-rw-r--r--magnum/drivers/common/templates/swarm/fragments/write-cluster-failure-service.yaml3
-rw-r--r--magnum/drivers/common/templates/swarm/fragments/write-swarm-agent-service.sh4
-rw-r--r--magnum/drivers/common/templates/swarm/fragments/write-swarm-master-service.sh2
4 files changed, 6 insertions, 7 deletions
diff --git a/magnum/drivers/common/templates/swarm/fragments/cfn-signal.sh b/magnum/drivers/common/templates/swarm/fragments/cfn-signal.sh
index 15cb35f..b525c90 100644
--- a/magnum/drivers/common/templates/swarm/fragments/cfn-signal.sh
+++ b/magnum/drivers/common/templates/swarm/fragments/cfn-signal.sh
@@ -9,8 +9,8 @@ REASON="Setup complete"
9DATA="OK" 9DATA="OK"
10UUID=`uuidgen` 10UUID=`uuidgen`
11 11
12data=$(echo '{"Status": "'${STATUS}'", "Reason": "'$REASON'", "Data": "'${DATA}'", "Id": "'$UUID'"}') 12data=$(echo '{"status": "'${STATUS}'", "reason": "'$REASON'", "data": "'${DATA}'", "id": "'$UUID'"}')
13 13
14curl -k -i -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $WAIT_HANDLE_TOKEN" \ 14curl -k -i -X POST -H "Content-Type: application/json" -H "X-Auth-Token: $WAIT_HANDLE_TOKEN" \
15 --data-binary "'$data'" \ 15 --data-binary "$data" \
16 "$WAIT_HANDLE_ENDPOINT" 16 "$WAIT_HANDLE_ENDPOINT"
diff --git a/magnum/drivers/common/templates/swarm/fragments/write-cluster-failure-service.yaml b/magnum/drivers/common/templates/swarm/fragments/write-cluster-failure-service.yaml
index 245a3b7..9b02c80 100644
--- a/magnum/drivers/common/templates/swarm/fragments/write-cluster-failure-service.yaml
+++ b/magnum/drivers/common/templates/swarm/fragments/write-cluster-failure-service.yaml
@@ -11,7 +11,6 @@ write_files:
11 [Service] 11 [Service]
12 Type=simple 12 Type=simple
13 TimeoutStartSec=0 13 TimeoutStartSec=0
14 UUID=`uuidgen`
15 ExecStart=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \ 14 ExecStart=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \
16 --data-binary "'"'{"Status": "FAILURE", "Reason": "$SERVICE service failed to start.", "Data": "Failure", "Id": "$UUID"}'"'" \ 15 --data-binary '{"status": "FAILURE", "reason": "$SERVICE service failed to start.", "data": "Failure"}' \
17 "$WAIT_HANDLE_ENDPOINT" 16 "$WAIT_HANDLE_ENDPOINT"
diff --git a/magnum/drivers/common/templates/swarm/fragments/write-swarm-agent-service.sh b/magnum/drivers/common/templates/swarm/fragments/write-swarm-agent-service.sh
index 3e34471..a6f6a74 100644
--- a/magnum/drivers/common/templates/swarm/fragments/write-swarm-agent-service.sh
+++ b/magnum/drivers/common/templates/swarm/fragments/write-swarm-agent-service.sh
@@ -67,6 +67,7 @@ chmod 644 $CONF_FILE
67 67
68SCRIPT=/usr/local/bin/notify-heat 68SCRIPT=/usr/local/bin/notify-heat
69 69
70UUID=`uuidgen`
70cat > $SCRIPT << EOF 71cat > $SCRIPT << EOF
71#!/bin/sh 72#!/bin/sh
72until etcdctl \ 73until etcdctl \
@@ -79,9 +80,8 @@ do
79 sleep 5 80 sleep 5
80done 81done
81 82
82UUID=`uuidgen`
83curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \ 83curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \
84 --data-binary "'"'{"Status": "SUCCESS", "Reason": "Swarm agent ready", "Data": "OK", "Id": "'${UUID}'"}'"'" \ 84 --data-binary '{"status": "SUCCESS", "reason": "Swarm agent ready", "data": "OK", "id": "${UUID}"}' \
85 "$WAIT_HANDLE_ENDPOINT" 85 "$WAIT_HANDLE_ENDPOINT"
86EOF 86EOF
87 87
diff --git a/magnum/drivers/common/templates/swarm/fragments/write-swarm-master-service.sh b/magnum/drivers/common/templates/swarm/fragments/write-swarm-master-service.sh
index eefba19..8f5fbaf 100644
--- a/magnum/drivers/common/templates/swarm/fragments/write-swarm-master-service.sh
+++ b/magnum/drivers/common/templates/swarm/fragments/write-swarm-master-service.sh
@@ -51,7 +51,7 @@ cat >> /etc/systemd/system/swarm-manager.service << END_SERVICE_BOTTOM
51ExecStop=/usr/bin/docker stop swarm-manager 51ExecStop=/usr/bin/docker stop swarm-manager
52Restart=always 52Restart=always
53ExecStartPost=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \\ 53ExecStartPost=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \\
54 --data-binary "'"'{"Status": "SUCCESS", "Reason": "Setup complete", "Data": "OK", "Id": "$UUID"}'"'" \\ 54 --data-binary '{"status": "SUCCESS", "reason": "Setup complete", "data": "OK", "id": "$UUID"}' \\
55 "$WAIT_HANDLE_ENDPOINT" 55 "$WAIT_HANDLE_ENDPOINT"
56 56
57[Install] 57[Install]