cdc5a35a7f
Adds a simple command line utility that will exist in all TripleO containers (we may need this in a variety of places) so that we can quickly figure out whether a command should execute on the bootstrap node (or not). For example: ./bootstrap_host_exec heat_engine heat-manage db_sync would only execute the DB sync for heat on the bootstrap node. Internally the script uses hieradata to determine when to run the supplied command. Also, adds openstack-tripleo-common to the base container image so we can use it in a variety of container images. Related-Bug: #1688380 Change-Id: If25f217bbb592edab4e1dde53ca99ed93c0e146c
20 lines
504 B
Bash
Executable File
20 lines
504 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
SERVICE_NAME=$1
|
|
if [ -z "$SERVICE_NAME" ]; then
|
|
echo "Please supply a valid service name."
|
|
exit 1
|
|
fi
|
|
shift
|
|
if [ -z "$*" ]; then
|
|
echo "Please supply a valid 'command' to run as an argument."
|
|
exit 1
|
|
fi
|
|
HOSTNAME=$(/bin/hostname -s)
|
|
SERVICE_NODEID=$(/bin/hiera -c /etc/puppet/hiera.yaml "${SERVICE_NAME}_short_bootstrap_node_name")
|
|
if [[ "$HOSTNAME" == "$SERVICE_NODEID" ]]; then
|
|
eval $*
|
|
else
|
|
echo "Skipping execution since this is not the bootstrap node for this service."
|
|
fi
|