From cec94efde0613dfbec7355ebe9589b5cbed1cfcb Mon Sep 17 00:00:00 2001 From: Olivier Grand Date: Thu, 4 Mar 2021 14:00:58 +0000 Subject: [PATCH] fix log-k8s when .kube directory not present --- bosh-cli/log-k8s.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bosh-cli/log-k8s.sh b/bosh-cli/log-k8s.sh index 8958d08..6fd2373 100644 --- a/bosh-cli/log-k8s.sh +++ b/bosh-cli/log-k8s.sh @@ -67,6 +67,10 @@ if [ ${flagError} = 0 ] ; then esac done + if [ ! -d ${HOME}/.kube ] ; then + mkdir ${HOME}/.kube > /dev/null 2>&1 + fi + if [ "${K8S_TYPE}" = "k8s" ] ; then #--- Check if bosh dns exists K8S_API_ENDPOINT="${K8S_CLUSTER}-api.internal.paas" @@ -78,7 +82,7 @@ if [ ${flagError} = 0 ] ; then printf "\n" CRT_DIR=${HOME}/.kube/certs if [ ! -d ${CRT_DIR} ] ; then - mkdir -p ${CRT_DIR} > /dev/null 2>&1 + mkdir ${CRT_DIR} > /dev/null 2>&1 fi bosh int <(credhub get -n "/${K8S_DIRECTOR}/${K8S_DEPLOYMENT}/tls-ca" --output-json) --path=/value/ca > ${CRT_DIR}/${K8S_CLUSTER}_ca.pem