tripleo-common/scripts/bootstrap_host_only_eval
Pablo Iranzo Gómez 79a1a4b275
Add bashate in gate jobs and fix existing errors
Change-Id: I3cbf754ea9c037df8b95eb6f83dbe8ce09bfd717
Signed-off-by: Pablo Iranzo Gómez <Pablo.Iranzo@gmail.com>
2018-09-17 11:36:57 +02:00

20 lines
524 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