From f24443c4ef1f44df99d54a2f2a13ee47f848e4c7 Mon Sep 17 00:00:00 2001 From: gjmzj Date: Wed, 10 Jul 2019 18:29:07 +0800 Subject: [PATCH] =?UTF-8?q?easzup:=20=E4=BF=AE=E5=A4=8Ddocker=E5=B7=B2?= =?UTF-8?q?=E7=BB=8F=E5=AE=89=E8=A3=85=E6=97=B6=E8=BF=90=E8=A1=8C=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/easzup | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/easzup b/tools/easzup index bb0f362..1e81327 100755 --- a/tools/easzup +++ b/tools/easzup @@ -94,17 +94,20 @@ function get_kubeasz() { # check if kubeasz already existed [[ -d "/etc/ansible/roles/kube-node" ]] && { echo "[WARN] kubeasz already existed"; return 0; } - echo -e "[INFO] \033[33mdownloading kubeasz\033[0m $KUBEASZ_VER" && \ - docker pull easzlab/kubeasz:${KUBEASZ_VER} && \ - echo "[INFO] run a temporary container" && \ - docker run -d --name temp_easz easzlab/kubeasz:${KUBEASZ_VER} && \ - mv "/etc/ansible/down/docker-${DOCKER_VER}.tgz" /tmp && \ + echo -e "[INFO] \033[33mdownloading kubeasz\033[0m $KUBEASZ_VER" + echo "[INFO] run a temporary container" + docker run -d --name temp_easz easzlab/kubeasz:${KUBEASZ_VER} || { echo "[ERROR] download failed."; exit 1; } + + [[ -f "/etc/ansible/down/docker-${DOCKER_VER}.tgz" ]] && mv "/etc/ansible/down/docker-${DOCKER_VER}.tgz" /tmp + rm -rf /etc/ansible && \ echo "[INFO] cp kubeasz code from the temporary container" && \ docker cp temp_easz:/etc/ansible /etc/ansible && \ echo "[INFO] stop&remove temporary container" && \ - docker rm -f temp_easz && \ - mv "/tmp/docker-${DOCKER_VER}.tgz" /etc/ansible/down + docker rm -f temp_easz + + [[ -f "/tmp/docker-${DOCKER_VER}.tgz" ]] && mv "/tmp/docker-${DOCKER_VER}.tgz" /etc/ansible/down + return 0 } function get_k8s_bin() {