Signal all o-a-c deployments in 99-refresh-completed

Currently we have a TripleO specific template pattern, where all
deployment resources are configured NO_SIGNAL, regardless of what
DefaultSignalTransport is set to, and only one signal for all
deployments is sent via the *AllNodesDeployment resources, by adding
the heat-generated deploy_signal_id to the structured config data
consumed by os-apply-config (as "completion-signal").

This is inconsistent with all signalling done via heat-config (e.g
everything other than o-a-c, which is triggered via a hook via
55-heat-config, this transparently consumes the heat-generated
deploy_signal_id and signals heat after each deployment hook is
run.

To allow per-deployment signalling for os-apply-config configs,
this adds logic which looks in the deployment data processed by
os-apply-config and signals all deployments deploying a config with
group "os-apply-config" (everything else should be handled by 55-heat-config)

Note that if the deployment is configured NO_SIGNAL, no deploy_signal_id
will be set, thus this will do nothing, and currently this won't work with
HEAT_SIGNAL, only CFN_SIGNAL (which is the default for deployments with no
signal_transport specified).  In future it would be good to add support for
HEAT_SIGNAL to break the dependency on heat-api-cfn.

This is backwards compatible, but after it's merged we can remove all the
NO_SIGNAL's in the templates, and the completion-signal key from the
allNodesConfig, which should in future allow more flexible control of
the ordering of metadata update for configs applied via o-a-c (as well
as better visibility of progres during deployment).

Co-Authored-By: Dan Prince <dprince@redhat.com>

Change-Id: I72ea524effd07deeb432fb38ee7da5f3dc7990a7
Closes-Bug: #1389178
This commit is contained in:
Steven Hardy 2015-01-08 12:05:15 +00:00
parent 536d32e69e
commit 93e05f569e
2 changed files with 18 additions and 0 deletions

View File

@ -1,6 +1,11 @@
#!/bin/bash
set -eux
# Some templates explictly pass completion-handle/completion-signal in the
# StructuredConfig data, if we find a handle, send a completion signal
# Note, this for backwards compatibility, in general the logic below should be
# used instead, where a per-deployment signal is sent using the handle provided
# automatically by heat
HANDLE=$(os-apply-config --key completion-handle --type raw --key-default "")
SIGNAL=$(os-apply-config --key completion-signal --type raw --key-default "")
ID=$(os-apply-config --key instance-id --type raw --key-default "")
@ -26,3 +31,15 @@ fi
if [ -n "$SIGNAL" ]; then
call_curl POST $SIGNAL
fi
# This extracts "deploy_signal_id" from any deployments of group "os-apply-config"
# deploy_signal_id is a pre-signed URL when CFN_SIGNAL is specified, it's not
# included if NO_SIGNAL is specified. Won't yet work with HEAT_SIGNAL.
DEPLOYMENT_HANDLES=$(os-apply-config --key deployments --type raw --key-default "" | \
jq -r "map(select(.group == \"os-apply-config\") | .inputs | \
map(select(.name == \"deploy_signal_id\"))) | .[][].value")
for url in ${DEPLOYMENT_HANDLES}
do
echo "Signalling deploy_signal_handle=$url"
call_curl POST $url
done