From 4358552d8b9d345c612e58f2e4b0ddbebca14e80 Mon Sep 17 00:00:00 2001 From: Tin Lam Date: Tue, 13 Jun 2017 23:06:47 -0500 Subject: [PATCH] Fix whitespace linter trap When the linter fails due to trailing whitespaces, the trapped dump_logs.sh execution will attempt to collect logs using kubectl, which is not installed, causing further errors in the log. This patch set prevents the log gathering if kubectl does not exists. Change-Id: I83c13caec2ece7cc8ec9bfd838ae7d4af9dcbed3 --- tools/gate/dump_logs.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/gate/dump_logs.sh b/tools/gate/dump_logs.sh index ac6a3eb9d2..4bc89413c4 100755 --- a/tools/gate/dump_logs.sh +++ b/tools/gate/dump_logs.sh @@ -1,5 +1,12 @@ #!/bin/bash set +xe + +# if we can't find kubectl, bail immediately because it is likely +# the whitespace linter fails - no point to collect logs. +if ! type "kubectl" &> /dev/null; then + exit $1 +fi + echo "Capturing logs from environment." mkdir -p ${LOGS_DIR}/k8s/etc