fix: Don't run ipmitool without knowing a type (#6504)

This commit is contained in:
Simon Mott
2017-04-25 21:36:52 +01:00
committed by Neil Lathwood
parent 66b7077a01
commit 6c6499c2fe

View File

@@ -18,9 +18,15 @@ if (is_array($ipmi_rows)) {
$remote = " -H " . $ipmi['host'] . " -U '" . $ipmi['user'] . "' -P '" . $ipmi['password'] . "' -L USER";
}
// Check to see if we know which IPMI interface to use
// so we dont use wrong arguments for ipmitool
if ($ipmi['type'] != '') {
$results = external_exec($config['ipmitool'] . ' -I ' . $ipmi['type'] . ' -c ' . $remote . ' sdr 2>/dev/null');
d_echo($results);
echo " done.\n";
} else {
echo " type not yet discovered.\n";
}
foreach (explode("\n", $results) as $row) {
list($desc, $value, $type, $status) = explode(',', $row);