diff options
author | Harald Musum <musum@yahoo-inc.com> | 2016-06-29 21:07:29 +0200 |
---|---|---|
committer | Harald Musum <musum@yahoo-inc.com> | 2016-06-29 21:07:29 +0200 |
commit | 62add73bc6b3862952daf2060b2d31d1ebb73652 (patch) | |
tree | 2101351c98fb89a51e723b643950c9d361a6c61e /node-admin | |
parent | fb31f9337a770cfad3cd714c2e2560f3dfeeaff6 (diff) |
Add both Docker host and Docker nodes with "add" command
* Use "add" command for adding both Docker hosts and Docker nodes
* Add Docker host if -f option supplied
* Support adding no Docker nodes
* Remove "add-host" command
Diffstat (limited to 'node-admin')
-rwxr-xr-x | node-admin/scripts/node-repo.sh | 73 |
1 files changed, 11 insertions, 62 deletions
diff --git a/node-admin/scripts/node-repo.sh b/node-admin/scripts/node-repo.sh index 82c770bd645..94173a6726b 100755 --- a/node-admin/scripts/node-repo.sh +++ b/node-admin/scripts/node-repo.sh @@ -12,11 +12,9 @@ Usage: ${0##*/} <command> [<args>...] Script for manipulating the Node Repository. Commands - add [-c <configserverhost>] -p <parenthostname> <hostname>... - Provision node <hostname> in node repo with flavor "docker". - add-host [-c <configserverhost>] <parenthostname> <parenthostname flavor> [<hostname>...] - Provision Docker host <parenthostname> in node repo with type "host" and flavor as given. - Provision Docker nodes <hostname> (0 or more) in node repo with flavor "docker". + add [-c <configserverhost>] [-f <parent host flavor>] -p <parenthostname> [<hostname>...] + Provision Docker host <parenthostname> in node repo with type "host", flavor <parent host flavor> (only if -f option supplied). + Provision Docker nodes <hostname...> list (0 or more) in node repo with flavor "docker" and parent host <parenthostname>. reprovision [-c <configserverhost>] -p <parenthostname> <hostname>... Fail node <hostname>, then rm and add. rm [-c <configserverhost>] <hostname>... @@ -184,11 +182,12 @@ function AddCommand { OPTIND=1 local option - while getopts "c:p:" option + while getopts "c:p:f:" option do case "$option" in c) config_server_hostname="$OPTARG" ;; p) parent_hostname="$OPTARG" ;; + f) parent_host_flavor="$OPTARG" ;; ?) exit 1 ;; # E.g. option lacks argument, in case error has been # already been printed *) Fail "Unknown option '$option' with value '$OPTARG'" @@ -197,68 +196,19 @@ function AddCommand { if [ -z "$parent_hostname" ] then - Fail "Parent hostname not specified (-d)" - fi - - shift $((OPTIND - 1)) - - if (($# == 0)) - then - Fail "No node hostnames were specified" + Fail "Parent hostname not specified (-p)" fi - echo -n "Provisioning $# nodes" - - local container_hostname - for container_hostname in "$@" - do - ProvisionDockerNode "$config_server_hostname" \ - "$container_hostname" \ - "$parent_hostname" - echo -n . - done - - echo " done" -} - -function AddHostCommand { - local config_server_hostname=config-server - - OPTIND=1 - local option - while getopts "c:" option - do - case "$option" in - c) config_server_hostname="$OPTARG" ;; - ?) exit 1 ;; # E.g. option lacks argument, in case error has been - # already been printed - *) Fail "Unknown option '$option' with value '$OPTARG'" - esac - done - shift $((OPTIND - 1)) - if (($# == 0)) + if [ -n "$parent_host_flavor" ] then - Fail "No hostname was specified" + echo "Provisioning Docker host $parent_hostname with flavor $parent_host_flavor" + ProvisionDockerHost "$config_server_hostname" \ + "$parent_hostname" \ + "$parent_host_flavor" fi - local parent_hostname="$1" - shift - - if (($# == 0)) - then - Fail "No flavor was specified" - fi - local flavor="$1" - shift - - echo "Provisioning Docker host $parent_hostname with flavor $flavor" - ProvisionDockerHost "$config_server_hostname" \ - "$parent_hostname" \ - "$flavor" - - echo -n "Provisioning $# nodes with parent host $parent_hostname" local container_hostname for container_hostname in "$@" @@ -389,7 +339,6 @@ function Main { case "$command" in add) AddCommand "$@" ;; - add-host) AddHostCommand "$@" ;; reprovision) ReprovisionCommand "$@" ;; rm) RemoveCommand "$@" ;; set-state) SetStateCommand "$@" ;; |