Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ipmi-server/rootfs/app/src/Controller/IpmiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private function runChassisCommand(Request $request, string $type):JsonResponse

private function runCommand($command, $ignoreErrors = false): bool|string
{
$errorIntro = "Error occurred when running \"" . implode(" ", $command) . "\".\n" ;
$errorIntro = "Error occurred when running \"" . implode(" ", array_map($this->anonymizePassword(...), $command)) . "\".\n" ;

try {
$proc = new Process($command);
Expand Down Expand Up @@ -189,6 +189,7 @@ private function getCommand(Request $request): array|bool

$user = $query->get('user', '');
$pass = $query->get('password', '');
$role = $query->get('role', '');
$extra = $query->get('extra', '');

$cmd = ['ipmitool', '-H', $host, '-p', $query->get('port', self::DEFAULT_PORT)];
Expand All @@ -203,6 +204,11 @@ private function getCommand(Request $request): array|bool
$cmd[] = $pass;
}

if (!empty($role)) {
$cmd[] = '-L';
$cmd[] = $role;
}

if (!empty($extra)) {
$cmd[] = $extra;
}
Expand Down Expand Up @@ -350,7 +356,6 @@ private function getSensorsByInterface(Request $request, string $interface): arr

if ($cmd !== false) {
try {
// $response['success'] = $this->extractFromSensorCommand($cmd, $interface, $sensorData, $states);
$response['success'] = $this->extractFromSdrCommand($cmd, $interface, $sensorData, $states);
$this->extractFromDcmiPowerReadingCommand($cmd, $interface, $sensorData, $states);

Expand Down