Browse Source

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
master
Dustin Specker 2 months ago
parent
commit
c234b72abd
2 changed files with 3 additions and 13 deletions
  1. 2
    12
      tools/execute_shipyard_action.sh
  2. 1
    1
      tools/redeploy_server.sh

+ 2
- 12
tools/execute_shipyard_action.sh View File

@@ -32,7 +32,7 @@ run_action () {
32 32
 
33 33
     # Define Variables
34 34
     action=$1
35
-    servers=$2
35
+    action_args="${@:2}"
36 36
 
37 37
     # Define Color
38 38
     NC='\033[0m'
@@ -47,17 +47,7 @@ run_action () {
47 47
     # Execute action
48 48
     echo -e "Execute ${action} Dag...\n"
49 49
 
50
-    # Note that deploy and update site do not require additional parameter
51
-    # to be passed in while redeploy_server requires user to indicate which
52
-    # servers to redeploy
53
-    if ! [[ ${servers} ]] && [[ ${action} ]]; then
54
-        ${base_docker_command} ${SHIPYARD_IMAGE} create action ${action}
55
-    elif [[ ${action} == 'redeploy_server' && ${servers} ]]; then
56
-        ${base_docker_command} ${SHIPYARD_IMAGE} create action redeploy_server --param="target_nodes=${servers}"
57
-    else
58
-        echo "Invalid Input!"
59
-        exit 1
60
-    fi
50
+    ${base_docker_command} ${SHIPYARD_IMAGE} create action ${action} ${action_args}
61 51
 
62 52
     # The status or lifecycle phase of an action can be
63 53
     #

+ 1
- 1
tools/redeploy_server.sh View File

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

Loading…
Cancel
Save