Skip to content

Commit d34146a

Browse files
author
Adam K Dean
committed
feat(provision-rackspace): added optional parameter to specify environment
1 parent 816e718 commit d34146a

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

contrib/rackspace/provision-rackspace-cluster.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Usage: ./provision-rackspace-cluster.sh <key pair name> [flavor]
3+
# Usage: ./provision-rackspace-cluster.sh <key pair name> [flavor] [environment]
44
#
55

66
set -e
@@ -11,7 +11,7 @@ CONTRIB_DIR=$(dirname $THIS_DIR)
1111
source $CONTRIB_DIR/utils.sh
1212

1313
if [ -z "$1" ]; then
14-
echo_red 'Usage: provision-rackspace-cluster.sh <key pair name> [flavor]'
14+
echo_red 'Usage: provision-rackspace-cluster.sh <key pair name> [flavor] [environment]'
1515
exit 1
1616
fi
1717

@@ -21,17 +21,23 @@ else
2121
FLAVOR=$2
2222
fi
2323

24+
if [ -z "$3" ]; then
25+
ENV="production"
26+
else
27+
ENV=$3
28+
fi
29+
2430
if ! which supernova > /dev/null; then
2531
echo_red 'Please install the dependencies listed in the README and ensure they are in your $PATH.'
2632
exit 1
2733
fi
2834

29-
if ! supernova production network-list|grep -q deis &>/dev/null; then
35+
if ! supernova $ENV network-list|grep -q deis &>/dev/null; then
3036
echo_yellow "Creating deis private network..."
31-
supernova production network-create deis 10.21.12.0/24
37+
supernova $ENV network-create deis 10.21.12.0/24
3238
fi
3339

34-
NETWORK_ID=`supernova production network-list|grep deis|awk -F"|" '{print $2}'|sed 's/^ *//g'`
40+
NETWORK_ID=`supernova $ENV network-list|grep deis|awk -F"|" '{print $2}'|sed 's/^ *//g'`
3541

3642
if [ -z "$DEIS_NUM_INSTANCES" ]; then
3743
DEIS_NUM_INSTANCES=3
@@ -42,9 +48,8 @@ $CONTRIB_DIR/util/check-user-data.sh
4248

4349
i=1 ; while [[ $i -le $DEIS_NUM_INSTANCES ]] ; do \
4450
echo_yellow "Provisioning deis-$i..."
45-
# This image is CoreOS 459.0.0, the most recent provided by Rackspace
46-
# Deis requires at least CoreOS 471.1.0
47-
supernova production boot --image 325a1c78-78e1-4367-be7a-1334b088018a --flavor $FLAVOR --key-name $1 --user-data ../coreos/user-data --no-service-net --nic net-id=$NETWORK_ID --config-drive true deis-$i ; \
51+
# this image is CoreOS 452.0.0
52+
supernova $ENV boot --image 7f116bdd-9b17-410c-b049-eb1bca1b7087 --flavor $FLAVOR --key-name $1 --user-data ../coreos/user-data --no-service-net --nic net-id=$NETWORK_ID --config-drive true deis-$i ; \
4853
((i = i + 1)) ; \
4954
done
5055

0 commit comments

Comments
 (0)