Skip to content

Commit

Permalink
Add flag, to be able fail on failed salt.master.env
Browse files Browse the repository at this point in the history
  * In test env's state: salt.master.env install all
    required formulas. Sometime, due apt repo issues,
    those step may fail.
    No sence to continue test w\o failed formula

Change-Id: Ibad580d13dfacf603716436ccd3027b6cd69039d
  • Loading branch information
alexz-kh committed Aug 23, 2018
1 parent 6753651 commit e3f6f40
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export DOMAIN=${DOMAIN:-bootstrap.local}
# salt
export MINION_ID=${MINION_ID:-${HOSTNAME}.${DOMAIN}}
export MASTER_HOSTNAME=${MASTER_HOSTNAME:-${HOSTNAME}.${DOMAIN}}
# Ignore state.apply salt.master.env error
export SA_IGNORE_ERROR_SALT_MASTER_ENV=${SA_IGNORE_ERROR_SALT_MASTER_ENV:-False}

# saltstack
BOOTSTRAP_SALTSTACK=${BOOTSTRAP_SALTSTACK:-True}
Expand Down Expand Up @@ -648,6 +650,10 @@ saltmaster_init() {
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!"
if [[ $SA_IGNORE_ERROR_SALT_MASTER_ENV =~ ^(False|false|0|no)$ ]]; then
exit 1
fi

fi

# Revert temporary SaltMaster minimal configuration, if any
Expand All @@ -662,6 +668,9 @@ saltmaster_init() {
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!"
if [[ $SA_IGNORE_ERROR_SALT_MASTER_ENV =~ ^(False|false|0|no)$ ]]; then
exit 1
fi
fi
fi
popd
Expand Down

0 comments on commit e3f6f40

Please sign in to comment.