修改当context不存在时,easzctl setup默认安装在default context

pull/485/head
gjmzj 2019-03-16 23:16:07 +08:00
parent 4509001ea6
commit fd22fb6db2
1 changed files with 5 additions and 3 deletions

View File

@ -240,11 +240,13 @@ function checkout() {
}
function setup() {
[ -d "$BASEPATH/.cluster" ] || { echo "[ERROR] invalid context, run 'easzctl checkout <cluster_name>' first"; return 1; }
save_context
[ -f "$BASEPATH/bin/kube-apiserver" ] || { echo "[ERROR] no binaries found, download then fist"; return 1; }
[ -f "$BASEPATH/hosts" ] || { echo "[ERROR] no ansible hosts found, read 'docs/setup/00-planning_and_overall_intro.md'"; return 1; }
echo -e "\n[INFO] setup begin in 5s, press 'Enter' to abort\n:"
[ -d "$BASEPATH/.cluster" ] || checkout default
save_context
CLUSTER=$(cat $BASEPATH/.cluster/current_cluster)
echo -e "\n[INFO] setup cluster with context: $CLUSTER"
echo -e "[INFO] setup begin in 5s, press 'Enter' to abort\n:"
! (read -t 5 ANS) || { echo "[WARN] setup aborted"; return 1; }
ansible-playbook $BASEPATH/90.setup.yml
}