Fix OSD header regex to match double-digit OSD numbers

The ceph-volume lvm list output varies the number of trailing equals
signs based on OSD number length:
- Single digit: "====== osd.5 =======" (7 equals)
- Double digit: "====== osd.19 ======" (6 equals)

Changed regex to require exactly 6 trailing equals, which matches
both formats.

Fixes: #17

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 20:23:10 -05:00
parent eb73e03495
commit b79c69be99

View File

@@ -667,8 +667,9 @@ build_ceph_cache() {
local current_osd=""
local osd_count=0
while IFS= read -r line; do
# Match OSD header: "====== osd.5 ======="
if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+======= ]]; then
# Match OSD header: "====== osd.5 =======" or "====== osd.19 ======"
# Number of trailing equals varies based on OSD number length
if [[ "$line" =~ ======[[:space:]]+osd\.([0-9]+)[[:space:]]+====== ]]; then
current_osd="osd.${BASH_REMATCH[1]}"
# Match "devices" line which has the actual physical device: " devices /dev/sda"
# This is more reliable than "block device" which may show LVM paths