audit echo vs log across all scripts — outcomes always visible, verbose for per-item loops
This commit is contained in:
@@ -395,7 +395,7 @@ local_start() {
|
||||
post_status=$(timeout "$DOCKER_TIMEOUT" docker inspect -f '{{.State.Running}}' \
|
||||
"$container" 2>/dev/null)
|
||||
if [[ "$post_status" == "true" ]]; then
|
||||
log "$ICON_STARTED $container started and running ✅"
|
||||
echo "$ICON_STARTED $container started and running ✅"
|
||||
return 0
|
||||
else
|
||||
error "$container started but crashed immediately"
|
||||
@@ -428,7 +428,7 @@ local_stop() {
|
||||
return 0
|
||||
fi
|
||||
timeout "$DOCKER_TIMEOUT" docker stop "$container" >/dev/null 2>&1 && \
|
||||
log "$ICON_STOPPED $container stopped" || \
|
||||
echo "$ICON_STOPPED $container stopped" || \
|
||||
error "Failed to stop $container locally"
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ remote_start() {
|
||||
"timeout $DOCKER_TIMEOUT docker inspect -f '{{.State.Running}}' \
|
||||
$container 2>/dev/null" 2>/dev/null)
|
||||
if [[ "$post_status" == "true" ]]; then
|
||||
log "$ICON_STARTED $container started on $REMOTE_SERVER_NAME ✅"
|
||||
echo "$ICON_STARTED $container started on $REMOTE_SERVER_NAME ✅"
|
||||
return 0
|
||||
else
|
||||
error "$container started on $REMOTE_SERVER_NAME but crashed immediately"
|
||||
@@ -497,7 +497,7 @@ remote_stop() {
|
||||
timeout "$SSH_TIMEOUT" ssh -i "$SSH_KEY" -o ConnectTimeout="$SSH_TIMEOUT" \
|
||||
root@"$REMOTE_SERVER" \
|
||||
"timeout $DOCKER_TIMEOUT docker stop $container" >/dev/null 2>&1 && \
|
||||
log "$ICON_STOPPED $container stopped on $REMOTE_SERVER_NAME" || \
|
||||
echo "$ICON_STOPPED $container stopped on $REMOTE_SERVER_NAME" || \
|
||||
error "Failed to stop $container on $REMOTE_SERVER_NAME"
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@ if [[ "$DRY_RUN" == false ]]; then
|
||||
if [[ -f "$FALLBACK_STATE_FILE" ]]; then
|
||||
NEW_STATE=$(grep "^state=" "$FALLBACK_STATE_FILE" 2>/dev/null | cut -d= -f2)
|
||||
if [[ "$NEW_STATE" == "FALLBACK" ]]; then
|
||||
log "State changed to FALLBACK — outage detected correctly ✅"
|
||||
echo "State changed to FALLBACK — outage detected correctly ✅"
|
||||
phase_pass "Fallback Detection"
|
||||
else
|
||||
error "State is $NEW_STATE — expected FALLBACK after ${FALLBACK_TEST_BLOCK_WAIT}s"
|
||||
@@ -364,7 +364,7 @@ if [[ "$DRY_RUN" == false ]]; then
|
||||
STATUS=$(timeout "$DOCKER_TIMEOUT" docker inspect -f '{{.State.Running}}' \
|
||||
"$container" 2>/dev/null)
|
||||
if [[ "$STATUS" == "true" ]]; then
|
||||
log "$ICON_RUNNING $container is running locally ✅"
|
||||
echo "$ICON_RUNNING $container is running locally ✅"
|
||||
else
|
||||
error "$ICON_NOT_RUNNING $container is NOT running locally"
|
||||
CONTAINERS_OK=false
|
||||
@@ -394,7 +394,7 @@ if [[ "$DRY_RUN" == false ]]; then
|
||||
|
||||
sleep 3
|
||||
if ping_remote; then
|
||||
log "$REMOTE_SERVER_NAME is reachable again ✅"
|
||||
echo "$REMOTE_SERVER_NAME is reachable again ✅"
|
||||
phase_pass "Restore Connectivity"
|
||||
else
|
||||
error "$REMOTE_SERVER_NAME still unreachable after removing iptables rule"
|
||||
@@ -420,7 +420,7 @@ if [[ "$DRY_RUN" == false ]]; then
|
||||
if [[ -f "$FALLBACK_STATE_FILE" ]]; then
|
||||
FINAL_STATE=$(grep "^state=" "$FALLBACK_STATE_FILE" 2>/dev/null | cut -d= -f2)
|
||||
if [[ "$FINAL_STATE" == "NORMAL" ]]; then
|
||||
log "State returned to NORMAL — handback completed ✅"
|
||||
echo "State returned to NORMAL — handback completed ✅"
|
||||
phase_pass "Handback"
|
||||
else
|
||||
error "State is $FINAL_STATE — expected NORMAL after ${FALLBACK_TEST_HANDBACK_WAIT}s"
|
||||
@@ -450,7 +450,7 @@ if [[ "$DRY_RUN" == false ]]; then
|
||||
STATUS=$(timeout "$DOCKER_TIMEOUT" docker inspect -f '{{.State.Running}}' \
|
||||
"$container" 2>/dev/null)
|
||||
if [[ "$STATUS" != "true" ]]; then
|
||||
log "$ICON_NOT_RUNNING $container stopped locally — handed back ✅"
|
||||
echo "$ICON_NOT_RUNNING $container stopped locally — handed back ✅"
|
||||
else
|
||||
error "$ICON_RUNNING $container still running locally — handback may have failed"
|
||||
HANDBACK_OK=false
|
||||
|
||||
Reference in New Issue
Block a user