tools: generalize execute_shipyard_action

This enables passing any combination of actions and parameters to this
script.  This also makes it easier to add scripts for additional actions
by not having to modify execute_shipyard_action.

Updated redeploy_server to pass in servers as a param.

Change-Id: I590183c28e8c66997ab85470902dbe9576c5c5f6
This commit is contained in:
Dustin Specker 2019-02-28 15:16:06 -06:00
parent f4f57a1bbf
commit c234b72abd
2 changed files with 3 additions and 13 deletions

View File

@ -32,7 +32,7 @@ run_action () {
# Define Variables
action=$1
servers=$2
action_args="${@:2}"
# Define Color
NC='\033[0m'
@ -47,17 +47,7 @@ run_action () {
# Execute action
echo -e "Execute ${action} Dag...\n"
# Note that deploy and update site do not require additional parameter
# to be passed in while redeploy_server requires user to indicate which
# servers to redeploy
if ! [[ ${servers} ]] && [[ ${action} ]]; then
${base_docker_command} ${SHIPYARD_IMAGE} create action ${action}
elif [[ ${action} == 'redeploy_server' && ${servers} ]]; then
${base_docker_command} ${SHIPYARD_IMAGE} create action redeploy_server --param="target_nodes=${servers}"
else
echo "Invalid Input!"
exit 1
fi
${base_docker_command} ${SHIPYARD_IMAGE} create action ${action} ${action_args}
# The status or lifecycle phase of an action can be
#

View File

@ -34,4 +34,4 @@ servers=$1
source set_env
# Execute shipyard action for redeploy_server
bash execute_shipyard_action.sh 'redeploy_server' ${servers}
bash execute_shipyard_action.sh 'redeploy_server' --param="target_nodes=${servers}"