Merge pull request #1394 from bgrant0607/gcutilfix

Fixes #1392. Redirects error messages to stderr so users can see them.
pull/6/head
Brendan Burns 2014-09-22 13:58:55 -07:00
commit 867e441e21
1 changed files with 17 additions and 11 deletions

View File

@ -35,7 +35,7 @@ function find-release() {
# Do one final check that we have a good release # Do one final check that we have a good release
if ! gsutil -q stat $RELEASE_NORMALIZED/master-release.tgz; then if ! gsutil -q stat $RELEASE_NORMALIZED/master-release.tgz; then
echo "Could not find release tar. If developing, make sure you have run src/release/release.sh to create a release." echo "Could not find release tar. If developing, make sure you have run src/release/release.sh to create a release." 1>&2
exit 1 exit 1
fi fi
echo "Release: ${RELEASE_NORMALIZED}" echo "Release: ${RELEASE_NORMALIZED}"
@ -49,7 +49,7 @@ function detect-project () {
fi fi
if [ -z "$PROJECT" ]; then if [ -z "$PROJECT" ]; then
echo "Could not detect Google Cloud Platform project. Set the default project using 'gcloud config set project <PROJECT>'" echo "Could not detect Google Cloud Platform project. Set the default project using 'gcloud config set project <PROJECT>'" 1>&2
exit 1 exit 1
fi fi
echo "Project: $PROJECT (autodetected from gcloud config)" echo "Project: $PROJECT (autodetected from gcloud config)"
@ -58,14 +58,19 @@ function detect-project () {
function detect-minions () { function detect-minions () {
KUBE_MINION_IP_ADDRESSES=() KUBE_MINION_IP_ADDRESSES=()
for (( i=0; i<${#MINION_NAMES[@]}; i++)); do for (( i=0; i<${#MINION_NAMES[@]}; i++)); do
# gcutil will print the "external-ip" column header even if no instances are found
local minion_ip=$(gcutil listinstances --format=csv --sort=external-ip \ local minion_ip=$(gcutil listinstances --format=csv --sort=external-ip \
--columns=external-ip --zone ${ZONE} --filter="name eq ${MINION_NAMES[$i]}" \ --columns=external-ip --zone ${ZONE} --filter="name eq ${MINION_NAMES[$i]}" \
| tail -n 1) | tail --lines=+2 | tail -n 1)
echo "Found ${MINION_NAMES[$i]} at ${minion_ip}" if [ -z "$minion_ip" ] ; then
KUBE_MINION_IP_ADDRESSES+=("${minion_ip}") echo "Did not find ${MINION_NAMES[$i]}" 1>&2
else
echo "Found ${MINION_NAMES[$i]} at ${minion_ip}"
KUBE_MINION_IP_ADDRESSES+=("${minion_ip}")
fi
done done
if [ -z "$KUBE_MINION_IP_ADDRESSES" ]; then if [ -z "$KUBE_MINION_IP_ADDRESSES" ]; then
echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'" echo "Could not detect Kubernetes minion nodes. Make sure you've launched a cluster with 'kube-up.sh'" 1>&2
exit 1 exit 1
fi fi
} }
@ -73,12 +78,13 @@ function detect-minions () {
function detect-master () { function detect-master () {
KUBE_MASTER=${MASTER_NAME} KUBE_MASTER=${MASTER_NAME}
if [ -z "$KUBE_MASTER_IP" ]; then if [ -z "$KUBE_MASTER_IP" ]; then
# gcutil will print the "external-ip" column header even if no instances are found
KUBE_MASTER_IP=$(gcutil listinstances --format=csv --sort=external-ip \ KUBE_MASTER_IP=$(gcutil listinstances --format=csv --sort=external-ip \
--columns=external-ip --zone ${ZONE} --filter="name eq ${MASTER_NAME}" \ --columns=external-ip --zone ${ZONE} --filter="name eq ${MASTER_NAME}" \
| tail -n 1) | tail --lines=+2 | tail -n 1)
fi fi
if [ -z "$KUBE_MASTER_IP" ]; then if [ -z "$KUBE_MASTER_IP" ]; then
echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" echo "Could not detect Kubernetes master node. Make sure you've launched a cluster with 'kube-up.sh'" 1>&2
exit 1 exit 1
fi fi
echo "Using master: $KUBE_MASTER (external IP: $KUBE_MASTER_IP)" echo "Using master: $KUBE_MASTER (external IP: $KUBE_MASTER_IP)"
@ -108,7 +114,7 @@ EOF
function verify-prereqs { function verify-prereqs {
for x in gcloud gcutil gsutil; do for x in gcloud gcutil gsutil; do
if [ "$(which $x)" == "" ]; then if [ "$(which $x)" == "" ]; then
echo "Can't find $x in PATH, please fix and retry." echo "Can't find $x in PATH, please fix and retry." 1>&2
exit 1 exit 1
fi fi
done done
@ -237,8 +243,8 @@ function kube-up {
# Make sure docker is installed # Make sure docker is installed
gcutil ssh ${MINION_NAMES[$i]} which docker > /dev/null gcutil ssh ${MINION_NAMES[$i]} which docker > /dev/null
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
echo "Docker failed to install on ${MINION_NAMES[$i]}. Your cluster is unlikely to work correctly." echo "Docker failed to install on ${MINION_NAMES[$i]}. Your cluster is unlikely to work correctly." 1>&2
echo "Please run ./cluster/kube-down.sh and re-create the cluster. (sorry!)" echo "Please run ./cluster/kube-down.sh and re-create the cluster. (sorry!)" 1>&2
exit 1 exit 1
fi fi
done done