Merge "Swarm: simplify heat WC signalling with $WAIT_CURL"

This commit is contained in:
Jenkins 2017-06-22 19:46:31 +00:00 committed by Gerrit Code Review
commit dc732d1d74
8 changed files with 10 additions and 26 deletions

View File

@ -11,6 +11,4 @@ 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" \ sh -c "${WAIT_CURL} --data-binary '${data}'"
--data-binary "$data" \
"$WAIT_HANDLE_ENDPOINT"

View File

@ -11,6 +11,5 @@ write_files:
[Service] [Service]
Type=simple Type=simple
TimeoutStartSec=0 TimeoutStartSec=0
ExecStart=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \ ExecStart=/usr/bin/$WAIT_CURL \
--data-binary '{"status": "FAILURE", "reason": "$SERVICE service failed to start.", "data": "Failure"}' \ --data-binary '{"status": "FAILURE", "reason": "$SERVICE service failed to start.", "data": "Failure"}'
"$WAIT_HANDLE_ENDPOINT"

View File

@ -5,8 +5,6 @@ write_files:
owner: "root:root" owner: "root:root"
permissions: "0600" permissions: "0600"
content: | content: |
WAIT_HANDLE_ENDPOINT="$WAIT_HANDLE_ENDPOINT"
WAIT_HANDLE_TOKEN="$WAIT_HANDLE_TOKEN"
WAIT_CURL="$WAIT_CURL" WAIT_CURL="$WAIT_CURL"
ETCD_DISCOVERY_URL="$ETCD_DISCOVERY_URL" ETCD_DISCOVERY_URL="$ETCD_DISCOVERY_URL"
DOCKER_VOLUME="$DOCKER_VOLUME" DOCKER_VOLUME="$DOCKER_VOLUME"

View File

@ -5,8 +5,6 @@ write_files:
owner: "root:root" owner: "root:root"
permissions: "0600" permissions: "0600"
content: | content: |
WAIT_HANDLE_ENDPOINT="$WAIT_HANDLE_ENDPOINT"
WAIT_HANDLE_TOKEN="$WAIT_HANDLE_TOKEN"
WAIT_CURL="$WAIT_CURL" WAIT_CURL="$WAIT_CURL"
DOCKER_VOLUME="$DOCKER_VOLUME" DOCKER_VOLUME="$DOCKER_VOLUME"
DOCKER_VOLUME_SIZE="$DOCKER_VOLUME_SIZE" DOCKER_VOLUME_SIZE="$DOCKER_VOLUME_SIZE"

View File

@ -80,9 +80,8 @@ do
sleep 5 sleep 5
done done
curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \ ${WAIT_CURL} \
--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 EOF
chown root:root $SCRIPT chown root:root $SCRIPT

View File

@ -50,9 +50,8 @@ cat >> /etc/systemd/system/swarm-manager.service << END_SERVICE_BOTTOM
etcd://$ETCD_SERVER_IP:2379/v2/keys/swarm/ etcd://$ETCD_SERVER_IP:2379/v2/keys/swarm/
ExecStop=/usr/bin/docker stop swarm-manager ExecStop=/usr/bin/docker stop swarm-manager
Restart=always Restart=always
ExecStartPost=/usr/bin/curl -k -i -X POST -H 'Content-Type: application/json' -H 'X-Auth-Token: $WAIT_HANDLE_TOKEN' \\ ExecStartPost=/usr/bin/$WAIT_CURL \\
--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] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -213,8 +213,6 @@ resources:
str_replace: str_replace:
template: {get_file: ../../common/templates/swarm/fragments/write-heat-params-master.yaml} template: {get_file: ../../common/templates/swarm/fragments/write-heat-params-master.yaml}
params: params:
"$WAIT_HANDLE_ENDPOINT": {get_attr: [master_wait_handle, endpoint]}
"$WAIT_HANDLE_TOKEN": {get_attr: [master_wait_handle, token]}
"$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]} "$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]}
"$DOCKER_VOLUME": {get_resource: docker_volume} "$DOCKER_VOLUME": {get_resource: docker_volume}
"$DOCKER_VOLUME_SIZE": {get_param: docker_volume_size} "$DOCKER_VOLUME_SIZE": {get_param: docker_volume_size}
@ -303,8 +301,7 @@ resources:
template: {get_file: ../../common/templates/swarm/fragments/write-cluster-failure-service.yaml} template: {get_file: ../../common/templates/swarm/fragments/write-cluster-failure-service.yaml}
params: params:
"$SERVICE": swarm-manager "$SERVICE": swarm-manager
"$WAIT_HANDLE_ENDPOINT": {get_attr: [master_wait_handle, endpoint]} "$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]}
"$WAIT_HANDLE_TOKEN": {get_attr: [master_wait_handle, token]}
write_docker_socket: write_docker_socket:
type: "OS::Heat::SoftwareConfig" type: "OS::Heat::SoftwareConfig"
@ -322,8 +319,7 @@ resources:
params: params:
"$ETCD_SERVER_IP": {get_attr: [etcd_address_switch, private_ip]} "$ETCD_SERVER_IP": {get_attr: [etcd_address_switch, private_ip]}
"$NODE_IP": {get_attr: [swarm_master_eth0, fixed_ips, 0, ip_address]} "$NODE_IP": {get_attr: [swarm_master_eth0, fixed_ips, 0, ip_address]}
"$WAIT_HANDLE_ENDPOINT": {get_attr: [master_wait_handle, endpoint]} "$WAIT_CURL": {get_attr: [master_wait_handle, curl_cli]}
"$WAIT_HANDLE_TOKEN": {get_attr: [master_wait_handle, token]}
"$HTTP_PROXY": {get_param: http_proxy} "$HTTP_PROXY": {get_param: http_proxy}
"$HTTPS_PROXY": {get_param: https_proxy} "$HTTPS_PROXY": {get_param: https_proxy}
"$NO_PROXY": {get_param: no_proxy} "$NO_PROXY": {get_param: no_proxy}

View File

@ -191,8 +191,6 @@ resources:
str_replace: str_replace:
template: {get_file: ../../common/templates/swarm/fragments/write-heat-params-node.yaml} template: {get_file: ../../common/templates/swarm/fragments/write-heat-params-node.yaml}
params: params:
"$WAIT_HANDLE_ENDPOINT": {get_attr: [node_wait_handle, endpoint]}
"$WAIT_HANDLE_TOKEN": {get_attr: [node_wait_handle, token]}
"$WAIT_CURL": {get_attr: [node_wait_handle, curl_cli]} "$WAIT_CURL": {get_attr: [node_wait_handle, curl_cli]}
"$DOCKER_VOLUME": {get_resource: docker_volume} "$DOCKER_VOLUME": {get_resource: docker_volume}
"$DOCKER_VOLUME_SIZE": {get_param: docker_volume_size} "$DOCKER_VOLUME_SIZE": {get_param: docker_volume_size}
@ -279,8 +277,7 @@ resources:
template: {get_file: ../../common/templates/swarm/fragments/write-cluster-failure-service.yaml} template: {get_file: ../../common/templates/swarm/fragments/write-cluster-failure-service.yaml}
params: params:
"$SERVICE": swarm-agent "$SERVICE": swarm-agent
"$WAIT_HANDLE_ENDPOINT": {get_attr: [node_wait_handle, endpoint]} "$WAIT_CURL": {get_attr: [node_wait_handle, curl_cli]}
"$WAIT_HANDLE_TOKEN": {get_attr: [node_wait_handle, token]}
write_swarm_agent_service: write_swarm_agent_service:
type: "OS::Heat::SoftwareConfig" type: "OS::Heat::SoftwareConfig"