Browse Source

fix(iscsi): replace sed call with bash internals

This removes a fork/exec and additionally gives more information in debug logs.
master
Harald Hoyer 3 years ago committed by Harald Hoyer
parent
commit
66b920c651
  1. 6
      modules.d/95iscsi/iscsiroot.sh

6
modules.d/95iscsi/iscsiroot.sh

@ -214,7 +214,11 @@ handle_netroot() { @@ -214,7 +214,11 @@ handle_netroot() {
if strglobin "$iscsi_target_ip" '*:*:*' && ! strglobin "$iscsi_target_ip" '['; then
iscsi_target_ip="[$iscsi_target_ip]"
fi
targets=$(iscsiadm -m discovery -t st -p "$iscsi_target_ip":${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/')
targets=$(iscsiadm -m discovery -t st -p "$iscsi_target_ip":${iscsi_target_port:+$iscsi_target_port} | {
while read -r _ target _ || [ -n "$target" ]; do
echo "$target"
done
})
[ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1

found=

Loading…
Cancel
Save