Skip to content

Commit 75522f4

Browse files
author
Matthew Fisher
committed
Merge pull request #1424 from deis/1361-private-network
feat(contrib): restrict to regions with private networking support
2 parents e270c73 + e079ffa commit 75522f4

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

contrib/digitalocean/provision-do-cluster.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@
55

66
set -e
77

8+
listcontains() {
9+
for i in $1; do
10+
[[ $i = $2 ]] && echo $i && return 0
11+
done
12+
return 1
13+
}
14+
815
THIS_DIR=$(cd $(dirname $0); pwd) # absolute path
916
CONTRIB_DIR=$(dirname $THIS_DIR)
1017

1118
source $CONTRIB_DIR/utils.sh
1219

20+
if [ -z "$4" ]; then
21+
echo_red 'Usage: provision-do-cluster.sh <REGION_ID> <IMAGE_ID> <SSH_ID> <SIZE>'
22+
exit 1
23+
fi
24+
1325
# check for DO tools in $PATH
1426
if ! which tugboat > /dev/null; then
1527
echo_red 'Please install the tugboat gem and ensure it is in your $PATH.'
@@ -20,6 +32,18 @@ if [ -z "$DEIS_NUM_INSTANCES" ]; then
2032
DEIS_NUM_INSTANCES=3
2133
fi
2234

35+
regions_with_private_networking=(4 5 6 7)
36+
if ! listcontains "$regions_with_private_networking" "$2";
37+
then
38+
echo_red "Invalid region. Please supply a region with private networking support."
39+
echo_red "Valid regions are:"
40+
echo_red "4: New York 2"
41+
echo_red "5: Amsterdam 2"
42+
echo_red "6: Singapore 1"
43+
echo_red "7: London 1"
44+
exit 1
45+
fi
46+
2347
# check that the CoreOS user-data file is valid
2448
$CONTRIB_DIR/util/check-user-data.sh
2549

0 commit comments

Comments
 (0)