diff options
author | Jhon Honce <jhonce@redhat.com> | 2015-02-04 12:53:43 -0700 |
---|---|---|
committer | Jhon Honce <jhonce@redhat.com> | 2015-02-04 12:53:43 -0700 |
commit | 076434d7a1026540f0eee5479adddc895d73b9b0 (patch) | |
tree | 6f24277acf16ea87bd34aebcf348134f10382145 | |
parent | 6fed637dac887656367a822da653c2969508a290 (diff) | |
parent | 1731951a3b1973690578ca83b876205c698d0ab2 (diff) | |
download | openshift-076434d7a1026540f0eee5479adddc895d73b9b0.tar.gz openshift-076434d7a1026540f0eee5479adddc895d73b9b0.tar.bz2 openshift-076434d7a1026540f0eee5479adddc895d73b9b0.tar.xz openshift-076434d7a1026540f0eee5479adddc895d73b9b0.zip |
Merge pull request #52 from pravisankar/cluster-config-opts
Bug 1163631 - Make master/minion playbook configurable in cluster.sh
-rw-r--r-- | README.md | 2 | ||||
-rwxr-xr-x | cluster.sh | 45 |
2 files changed, 35 insertions, 12 deletions
@@ -8,7 +8,7 @@ Setup - Install base dependencies: - Fedora: ``` - yum install -y ansible rubygem-thor rubygem-parseconfig + yum install -y ansible rubygem-thor rubygem-parseconfig util-linux ``` - Setup for a specific cloud: diff --git a/cluster.sh b/cluster.sh index 7f541e4f8..97b957a57 100755 --- a/cluster.sh +++ b/cluster.sh @@ -13,9 +13,10 @@ fi UPPER_CASE_PROVIDER=$(echo $PROVIDER | tr '[:lower:]' '[:upper:]') -# FIXME: Add options -MASTER_PLAYBOOK=openshift-master -MINION_PLAYBOOK=openshift-minion +# Use OO_MASTER_PLAYBOOK/OO_MINION_PLAYBOOK environment variables for playbooks if defined, +# otherwise use openshift default values. +MASTER_PLAYBOOK=${OO_MASTER_PLAYBOOK:-'openshift-master'} +MINION_PLAYBOOK=${OO_MINION_PLAYBOOK:-'openshift-minion'} # @formatter:off @@ -26,6 +27,12 @@ function usage { Supported environment tags: $(grep --no-messages 'SUPPORTED_ENVS.*=' ./lib/${PROVIDER}_command.rb) $([ $? -ne 0 ] && echo "No supported environment tags found for ${PROVIDER}") + + Optional arguments for create: + [-p|--provider, -m|--masters, -n|--minions, --master-playbook, --minion-playbook] + + Optional arguments for terminate|update: + [-p|--provider, --master-playbook, --minion-playbook] EOT } # @formatter:on @@ -52,16 +59,32 @@ function terminate_cluster { [ -f ./cloud.rb ] || (echo 1>&2 'Cannot find ./cloud.rb' && exit 1) -while getopts ':p:m:n:' flag; do - case "${flag}" in - p) PROVIDER="${OPTARG}" ;; - m) MASTERS="${OPTARG}" ;; - n) MINIONS="${OPTARG}" ;; - *) echo -e 2>&1 "unsupported option $OPTARG\n" - usage - exit 1 ;; +function check_argval { + if [[ $1 == -* ]]; then + echo "Invalid value: '$1'" + usage + exit 1 + fi +} + +# Using GNU getopt to support both small and long formats +OPTIONS=`getopt -o p:m:n:h --long provider:,masters:,minions:,master-playbook:,minion-playbook:,help \ + -n "$0" -- "$@"` +eval set -- "$OPTIONS" + +while true; do + case "$1" in + -h|--help) (usage; exit 1) ; shift ;; + -p|--provider) PROVIDER="$2" ; check_argval $2 ; shift 2 ;; + -m|--masters) MASTERS="$2" ; check_argval $2 ; shift 2 ;; + -n|--minions) MINIONS="$2" ; check_argval $2 ; shift 2 ;; + --master-playbook) MASTER_PLAYBOOK="$2" ; check_argval $2 ; shift 2 ;; + --minion-playbook) MINION_PLAYBOOK="$2" ; check_argval $2 ; shift 2 ;; + --) shift ; break ;; + *) break ;; esac done + shift $((OPTIND-1)) [ -z "${1:-}" ] && (usage; exit 1) |