Browse Source

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
Mark Goddard 1 year ago
parent
commit
8d0f25f130

+ 2
- 2
magnum/drivers/common/templates/swarm/fragments/cfn-signal.sh View File

@@ -9,8 +9,8 @@ REASON="Setup complete"
9 9
 DATA="OK"
10 10
 UUID=`uuidgen`
11 11
 
12
-data=$(echo '{"Status": "'${STATUS}'", "Reason": "'$REASON'", "Data": "'${DATA}'", "Id": "'$UUID'"}')
12
+data=$(echo '{"status": "'${STATUS}'", "reason": "'$REASON'", "data": "'${DATA}'", "id": "'$UUID'"}')
13 13
 
14 14
 curl -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 16
     "$WAIT_HANDLE_ENDPOINT"

+ 1
- 2
magnum/drivers/common/templates/swarm/fragments/write-cluster-failure-service.yaml View File

@@ -11,7 +11,6 @@ write_files:
11 11
       [Service]
12 12
       Type=simple
13 13
       TimeoutStartSec=0
14
-      UUID=`uuidgen`
15 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 16
         "$WAIT_HANDLE_ENDPOINT"

+ 2
- 2
magnum/drivers/common/templates/swarm/fragments/write-swarm-agent-service.sh View File

@@ -67,6 +67,7 @@ chmod 644 $CONF_FILE
67 67
 
68 68
 SCRIPT=/usr/local/bin/notify-heat
69 69
 
70
+UUID=`uuidgen`
70 71
 cat > $SCRIPT << EOF
71 72
 #!/bin/sh
72 73
 until etcdctl \
@@ -79,9 +80,8 @@ do
79 80
     sleep 5
80 81
 done
81 82
 
82
-UUID=`uuidgen`
83 83
 curl -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 85
     "$WAIT_HANDLE_ENDPOINT"
86 86
 EOF
87 87
 

+ 1
- 1
magnum/drivers/common/templates/swarm/fragments/write-swarm-master-service.sh View File

@@ -51,7 +51,7 @@ cat >> /etc/systemd/system/swarm-manager.service << END_SERVICE_BOTTOM
51 51
 ExecStop=/usr/bin/docker stop swarm-manager
52 52
 Restart=always
53 53
 ExecStartPost=/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 55
     "$WAIT_HANDLE_ENDPOINT"
56 56
 
57 57
 [Install]

Loading…
Cancel
Save