Merge pull request #29 from ibumarskov/master
Convert refspec to commit-id
diff --git a/bootstrap.sh b/bootstrap.sh
index 987633a..c36eac4 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -513,7 +513,7 @@
[ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service
# Set essentials if FORMULAS_SALT_MASTER is not defined at all
- [ -z ${FORMULAS_SALT_MASTER+x} ] && declare -a FORMULAS_SALT_MASTER=("linux" "reclass" "salt" "memcached")
+ [ -z ${FORMULAS_SALT_MASTER} ] && declare -a FORMULAS_SALT_MASTER=("linux" "reclass" "salt" "memcached")
for formula_service in "${FORMULAS_SALT_MASTER[@]}"; do
echo -e "\nConfiguring salt formula ${formula_service} ...\n"
[ ! -d "${FORMULAS_PATH}/env/${formula_service}" ] && \
@@ -540,7 +540,7 @@
[ ! -d ${RECLASS_ROOT}/classes/service ] && mkdir -p ${RECLASS_ROOT}/classes/service
# Set essentials if FORMULAS_SALT_MASTER is not defined at all
- [ -z ${FORMULAS_SALT_MASTER+x} ] && declare -a FORMULAS_SALT_MASTER=("linux" "reclass" "salt" "memcached")
+ [ -z ${FORMULAS_SALT_MASTER} ] && declare -a FORMULAS_SALT_MASTER=("linux" "reclass" "salt" "memcached")
for formula_service in "${FORMULAS_SALT_MASTER[@]}"; do
echo -e "\nConfiguring salt formula ${formula_service} ...\n"
_BRANCH=${FORMULAS_BRANCH}
@@ -623,30 +623,17 @@
set -e
$SUDO salt-call saltutil.sync_all >/dev/null
- # TODO: Placeholder update saltmaster spec (nodes/FQDN.yml) to be able to bootstrap with minimal configuration
- # (ie: with linux, git, salt formulas)
-
- #log_info "Verify SaltMaster, before salt-master is fully initialized"
- #if ! $SUDO reclass-salt -p ${MASTER_HOSTNAME} &> /tmp/${MASTER_HOSTNAME}.pillar;then
- # log_warn "Node verification before initialization failed."; cat /tmp/${MASTER_HOSTNAME}.pillar;
- #fi
-
# workarond isolated and not fully bootstraped environments
if [[ $RECLASS_IGNORE_CLASS_NOTFOUND =~ ^(True|true|1|yes)$ ]]; then
- SALT_MASTER_PILLAR='"salt":{"master":{"pillar":{"reclass":{"ignore_class_notfound": "'${RECLASS_IGNORE_CLASS_NOTFOUND:-False}'", "ignore_class_regexp": ["service.*"]}}}},'
+ SALT_MASTER_PILLAR='"salt":{"master":{"pillar":{"reclass":{"ignore_class_notfound": '${RECLASS_IGNORE_CLASS_NOTFOUND:-False}', "ignore_class_regexp": ["service.*"]}}}},'
fi
PILLAR='{'${SALT_MASTER_PILLAR}' "reclass":{"storage":{"data_source":{"engine":"local"}}} }'
log_info "State: salt.master.env,salt.master.pillar"
- if ! $SUDO salt-call ${SALT_OPTS} -linfo state.apply salt.master.env,salt.master.pillar pillar="$PILLAR"; then
- log_err "State salt.master.(env|pillar) failed, keep your eyes wide open."
+ if ! $SUDO salt-call ${SALT_OPTS} state.apply salt.master.env,salt.master.pillar pillar="$PILLAR"; then
+ log_err "State \`salt.master.env,salt.master.pillar pillar=$PILLAR\` failed, keep your eyes wide open!"
fi
- #log_info "State: salt.master.pillar"
- #retry ${SALT_STATE_RETRY} $SUDO salt-call ${SALT_OPTS} state.apply salt.master.pillar pillar="$PILLAR"
- ## Note: sikp reclass data dir states
- ## in order to avoid pull from configured repo/branch
-
# Revert temporary SaltMaster minimal configuration, if any
pushd $RECLASS_ROOT
if [ $(git diff --name-only nodes | sort | uniq | wc -l) -ge 1 ]; then
@@ -656,12 +643,10 @@
log_info "Checkout HEAD state of $RECLASS_ROOT/nodes/*."
git checkout -- $RECLASS_ROOT/nodes || true
log_info "Re-Run states: salt.master.env and salt.master.pillar according the HEAD state."
- log_info "State: salt.master.env"
- if ! $SUDO salt-call ${SALT_OPTS} -linfo state.apply salt.master.env pillar="$PILLAR"; then
- log_err "State salt.master.env failed, keep your eyes wide open."
+ log_info "State: salt.master.env,salt.master.pillar"
+ if ! $SUDO salt-call ${SALT_OPTS} state.apply salt.master.env,salt.master.pillar pillar="$PILLAR"; then
+ log_err "State \`salt.master.env,salt.master.pillar pillar=$PILLAR\` failed, keep your eyes wide open!"
fi
- log_info "State: salt.master.pillar"
- retry ${SALT_STATE_RETRY} $SUDO salt-call ${SALT_OPTS} state.apply salt.master.pillar pillar="$PILLAR"
fi
popd
@@ -671,7 +656,8 @@
log_info "State: salt.master.storage.node"
set +e
- # TODO: PLACEHOLDER TO TRIGGER NODE GENERATION THROUG SALT REACT.
+ # TODO: PLACEHOLDER TO TRIGGER NODE GENERATION THROUG SALT REACT.
+ # FIXME: PLACEHOLDER TO TRIGGER NODE GENERATION THROUG SALT REACT.
retry ${SALT_STATE_RETRY} $SUDO salt-call ${SALT_OPTS} state.apply reclass.storage.node
ret=$?
set -e
@@ -719,6 +705,7 @@
log_err "For more details see full log /tmp/${MASTER_HOSTNAME}.reclass.nodeinfo"
exit 1
fi
+ set +e
}
function verify_salt_minion() {
@@ -735,6 +722,7 @@
exit 1
fi
fi
+ set +e
}
function verify_salt_minions() {
@@ -770,6 +758,7 @@
tail -n50 /tmp/*.pillar_verify
return 1
}
+ #set +e
}