From ccc72c0792f14c7a26513226746d8a18d3033e08 Mon Sep 17 00:00:00 2001 From: Thomas Wiest Date: Thu, 30 Oct 2014 17:13:47 -0400 Subject: fixed cluster.sh to only run minion and master creation once, and to use -c if there are multiple needed. Also added nicer output. --- cluster.sh | 21 ++++++--------------- lib/aws_command.rb | 2 +- lib/gce_command.rb | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/cluster.sh b/cluster.sh index b44bff01e..30cfb5e75 100755 --- a/cluster.sh +++ b/cluster.sh @@ -20,14 +20,10 @@ EOT } # @formatter:on -function create_cluser { - for (( i = 0; i < $MASTERS; i ++ )); do - ./cloud.rb "${PROVIDER}" launch -e "${ENV}" --type=$MASTER_PLAYBOOK - done +function create_cluster { + ./cloud.rb "${PROVIDER}" launch -e "${ENV}" --type=$MASTER_PLAYBOOK -c $MASTERS - for (( i = 0; i < $MINIONS; i ++ )); do - ./cloud.rb "${PROVIDER}" launch -e "${ENV}" --type=$MINION_PLAYBOOK - done + ./cloud.rb "${PROVIDER}" launch -e "${ENV}" --type=$MINION_PLAYBOOK -c $MINIONS update_cluster @@ -35,13 +31,8 @@ function create_cluser { } function update_cluster { - for (( i = 0; i < $MASTERS; i ++ )); do - ./cloud.rb "${PROVIDER}" config -e "${ENV}" --type=$MASTER_PLAYBOOK - done - - for (( i = 0; i < $MINIONS; i ++ )); do - ./cloud.rb "${PROVIDER}" config -e "${ENV}" --type=$MINION_PLAYBOOK - done + ./cloud.rb "${PROVIDER}" config -e "${ENV}" --type=$MASTER_PLAYBOOK + ./cloud.rb "${PROVIDER}" config -e "${ENV}" --type=$MINION_PLAYBOOK } function terminate_cluster { @@ -69,7 +60,7 @@ case "${1}" in 'create') [ -z "${2:-}" ] && (usage; exit 1) ENV="${2}" - create_cluser ;; + create_cluster ;; 'update') [ -z "${2:-}" ] && (usage; exit 1) ENV="${2}" diff --git a/lib/aws_command.rb b/lib/aws_command.rb index b8ecb89ac..865901585 100644 --- a/lib/aws_command.rb +++ b/lib/aws_command.rb @@ -41,7 +41,7 @@ module OpenShift ah.extra_vars['oo_new_inst_tags'].merge!(AwsHelper.generate_env_host_type_tag(options[:env], options[:type])) puts - puts 'Creating instance(s) in AWS...' + puts "Creating #{options[:count]} #{options[:type]} instance(s) in AWS..." ah.ignore_bug_6407 # Make sure we're completely up to date before launching diff --git a/lib/gce_command.rb b/lib/gce_command.rb index ce3737a19..e8e00b746 100644 --- a/lib/gce_command.rb +++ b/lib/gce_command.rb @@ -42,7 +42,7 @@ module OpenShift ah.extra_vars['oo_new_inst_tags'] << GceHelper.generate_env_host_type_tag(options[:env], options[:type]) puts - puts 'Creating instance(s) in GCE...' + puts "Creating #{options[:count]} #{options[:type]} instance(s) in GCE..." ah.ignore_bug_6407 ah.run_playbook("playbooks/gce/#{options[:type]}/launch.yml") -- cgit v1.2.3