diff --git a/tools/easzctl b/tools/easzctl index 113925d..0af3871 100755 --- a/tools/easzctl +++ b/tools/easzctl @@ -240,11 +240,13 @@ function checkout() { } function setup() { - [ -d "$BASEPATH/.cluster" ] || { echo "[ERROR] invalid context, run 'easzctl checkout ' 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 }