fix: strip pre-existing unmanaged devices block before injecting managed stanza
If /etc/multipath.conf already had a manual devices{} block before package
install, postinst would append a second identical block, causing multipathd
to emit "duplicate keyword: devices" warnings. Strip any unmanaged devices
block in the append path to keep the file clean.
Fixes #279. Discovered 2026-06-20 on pve01-hq during SCALE 25.04 multipath testing.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1c723a8fb8
commit
b7acb605ee
|
|
@ -70,6 +70,14 @@ STANZA
|
|||
"$MULTIPATH_CONF"
|
||||
else
|
||||
log "Appending TrueNAS device stanza to existing ${MULTIPATH_CONF}"
|
||||
# Strip any pre-existing unmanaged devices block to prevent duplicate
|
||||
# keyword warnings in multipathd (e.g. user had a manual block before install).
|
||||
if grep -qE '^\s*devices\s*\{' "$MULTIPATH_CONF"; then
|
||||
log "Removing pre-existing unmanaged devices block from ${MULTIPATH_CONF}"
|
||||
perl -i -0777 -pe \
|
||||
's/\n*\ndevices\s*\{(?:[^{}]*|\{[^{}]*\})*\}\n*//gs' \
|
||||
"$MULTIPATH_CONF"
|
||||
fi
|
||||
printf '\n%s\n' "$stanza" >> "$MULTIPATH_CONF"
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue