Skip to content

Do not redirect stderr to /dev/null

Do not redirect stderr to /dev/null to avoid "silent death" on get-server-config

  • Before this patch, when I entered an invalid ZONE, the script would stop without informing me of the problem. As in:
export ZONE=eu-west1-b  # invalid zone
CLUSTER_VERSION=$(gcloud container get-server-config --zone $ZONE --format='value(defaultCl usterVersion)' 2>/dev/null); echo $CLUSTER_VERSION
  • With this patch that removes the redirect to /dev/null of stderr, I now see the cause of the failure:
export ZONE=eu-west1-b  # invalid zone
CLUSTER_VERSION=$(gcloud container get-server-config --zone $ZONE --format='value(defaultClusterVersion)'); echo $CLUSTER_VERSION
Fetching server config for eu-west1-b
ERROR: (gcloud.container.get-server-config) INVALID_ARGUMENT: location "eu-west1-b" does not exist.

I am willing to accept the Fetching server config for eu-west1-b line for a non-failing case as a side effedct:

ZONE=europe-west1-b  # valid zone
CLUSTER_VERSION=$(gcloud container get-server-config --zone $ZONE --format='value(defaultClusterVersion)'); echo $CLUSTER_VERSION
Fetching server config for europe-west1-b
1.8.8-gke.0

Merge request reports