easzup: 修复docker已经安装时运行失败问题

pull/641/head
gjmzj 2019-07-10 18:29:07 +08:00
parent a96acfce07
commit f24443c4ef
1 changed files with 10 additions and 7 deletions

View File

@ -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() {