Don't return garbage in mpath discovery if command failed
This commit is contained in:
parent
975e8f1ccc
commit
cd790587e6
|
@ -22,7 +22,13 @@ if (not defined $multipath){
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (qx($multipath -l -v1)){
|
my @dev = qx($multipath -l -v1);
|
||||||
|
# If command failed (eg no /etc/multipath.conf), then return an empty result
|
||||||
|
if ($? ne 0){
|
||||||
|
print to_json($json, { pretty => $pretty });
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
foreach (@dev){
|
||||||
chomp;
|
chomp;
|
||||||
push @{$json}, { '{#MPATH_DEV}' => $_ };
|
push @{$json}, { '{#MPATH_DEV}' => $_ };
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue