Add shell safety options (pipefail)

Added 'set -o pipefail' to ensure pipe failures are detected.

Not using -e (errexit) as the script is designed for graceful
degradation when optional tools (smartctl, ceph) are missing.
Many commands intentionally redirect stderr to /dev/null.

Not using -u (nounset) as the script uses ${var:-default}
patterns extensively for optional variables.

Fixes: #23

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 12:18:02 -05:00
parent 09cba482d4
commit 6dc0b00efd

View File

@@ -5,6 +5,12 @@
# Maps physical drive bays to logical device names using PCI paths # Maps physical drive bays to logical device names using PCI paths
#============================================================================== #==============================================================================
# Shell safety options:
# -o pipefail: Exit status of pipe is rightmost non-zero exit code
# Note: Not using -e (errexit) to allow graceful degradation when tools fail
# Note: Not using -u (nounset) as script uses ${var:-default} patterns
set -o pipefail
VERSION="1.1.0" VERSION="1.1.0"
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------