@@ -34,12 +34,12 @@ function cloud_init {
34
34
# Generate local ssh configuration
35
35
# NOTE(mdbooth): This command successfully populates ssh config and then
36
36
# fails for some reason I don't understand. We ignore the failure.
37
- gcloud compute config-ssh || true
37
+ gcloud compute config-ssh > /dev/null 2>&1 || true
38
38
}
39
39
40
40
function init_infrastructure() {
41
41
if [[ ${GCP_NETWORK_NAME} != " default" ]]; then
42
- if ! gcloud compute networks describe " $GCP_NETWORK_NAME " --project " $GCP_PROJECT " > /dev/null; then
42
+ if ! gcloud compute networks describe " $GCP_NETWORK_NAME " --project " $GCP_PROJECT " > /dev/null 2>&1 ; then
43
43
gcloud compute networks create --project " $GCP_PROJECT " " $GCP_NETWORK_NAME " --subnet-mode custom
44
44
gcloud compute networks subnets create " $GCP_NETWORK_NAME " --project " $GCP_PROJECT " \
45
45
--network=" $GCP_NETWORK_NAME " --range=" $PRIVATE_NETWORK_CIDR " --region " $GCP_REGION "
@@ -64,12 +64,12 @@ function init_infrastructure() {
64
64
gcloud compute networks list --project=" $GCP_PROJECT "
65
65
gcloud compute networks describe " $GCP_NETWORK_NAME " --project=" $GCP_PROJECT "
66
66
67
- if ! gcloud compute routers describe " ${CLUSTER_NAME} -myrouter" --project=" $GCP_PROJECT " --region=" $GCP_REGION " > /dev/null; then
67
+ if ! gcloud compute routers describe " ${CLUSTER_NAME} -myrouter" --project=" $GCP_PROJECT " --region=" $GCP_REGION " > /dev/null 2>&1 ; then
68
68
gcloud compute routers create " ${CLUSTER_NAME} -myrouter" --project=" $GCP_PROJECT " \
69
69
--region=" $GCP_REGION " --network=" $GCP_NETWORK_NAME "
70
70
fi
71
71
if ! gcloud compute routers nats describe --router=" $CLUSTER_NAME -myrouter" " $CLUSTER_NAME -mynat" \
72
- --project=" $GCP_PROJECT " --region=" ${GCP_REGION} " > /dev/null; then
72
+ --project=" $GCP_PROJECT " --region=" ${GCP_REGION} " > /dev/null 2>&1 ; then
73
73
gcloud compute routers nats create " ${CLUSTER_NAME} -mynat" --project=" $GCP_PROJECT " \
74
74
--router-region=" $GCP_REGION " --router=" ${CLUSTER_NAME} -myrouter" \
75
75
--nat-all-subnet-ip-ranges --auto-allocate-nat-external-ips
@@ -89,7 +89,7 @@ function create_vm {
89
89
# Loop over all zones in the GCP region to ignore a full zone.
90
90
# We are not able to use 'gcloud compute zones list' as the gcloud.compute.zones.list permission is missing.
91
91
for GCP_ZONE in " ${GCP_REGION} -a" " ${GCP_REGION} -b" " ${GCP_REGION} -c" ; do
92
- if ! gcloud compute instances describe " $servername " --project " $GCP_PROJECT " --zone " $GCP_ZONE " > /dev/null; then
92
+ if ! gcloud compute instances describe " $servername " --project " $GCP_PROJECT " --zone " $GCP_ZONE " > /dev/null 2>&1 ; then
93
93
if gcloud compute instances create " $servername " \
94
94
--project " $GCP_PROJECT " \
95
95
--zone " $GCP_ZONE " \
0 commit comments