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:
parent
f4f57a1bbf
commit
c234b72abd
@ -32,7 +32,7 @@ run_action () {
|
|||||||
|
|
||||||
# Define Variables
|
# Define Variables
|
||||||
action=$1
|
action=$1
|
||||||
servers=$2
|
action_args="${@:2}"
|
||||||
|
|
||||||
# Define Color
|
# Define Color
|
||||||
NC='\033[0m'
|
NC='\033[0m'
|
||||||
@ -47,17 +47,7 @@ run_action () {
|
|||||||
# Execute action
|
# Execute action
|
||||||
echo -e "Execute ${action} Dag...\n"
|
echo -e "Execute ${action} Dag...\n"
|
||||||
|
|
||||||
# Note that deploy and update site do not require additional parameter
|
${base_docker_command} ${SHIPYARD_IMAGE} create action ${action} ${action_args}
|
||||||
# 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
|
|
||||||
|
|
||||||
# The status or lifecycle phase of an action can be
|
# The status or lifecycle phase of an action can be
|
||||||
#
|
#
|
||||||
|
@ -34,4 +34,4 @@ servers=$1
|
|||||||
source set_env
|
source set_env
|
||||||
|
|
||||||
# Execute shipyard action for redeploy_server
|
# 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}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user