From 62add73bc6b3862952daf2060b2d31d1ebb73652 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Wed, 29 Jun 2016 21:07:29 +0200 Subject: 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 --- node-admin/scripts/node-repo.sh | 73 +++++++---------------------------------- 1 file changed, 11 insertions(+), 62 deletions(-) (limited to 'node-admin') 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##*/} [...] Script for manipulating the Node Repository. Commands - add [-c ] -p ... - Provision node in node repo with flavor "docker". - add-host [-c ] [...] - Provision Docker host in node repo with type "host" and flavor as given. - Provision Docker nodes (0 or more) in node repo with flavor "docker". + add [-c ] [-f ] -p [...] + Provision Docker host in node repo with type "host", flavor (only if -f option supplied). + Provision Docker nodes list (0 or more) in node repo with flavor "docker" and parent host . reprovision [-c ] -p ... Fail node , then rm and add. rm [-c ] ... @@ -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 "$@" ;; -- cgit v1.2.3