refs #1271 fix status that dont allow return status when is not installed oglives
parent
b5426fd188
commit
eb3fc2c9d1
|
|
@ -140,11 +140,23 @@ public function getStatus(): Response
|
||||||
$ogLiveConfigResult = $ogLiveResponse['output'];
|
$ogLiveConfigResult = $ogLiveResponse['output'];
|
||||||
$ogLiveExitCode = $ogLiveResponse['exitCode'];
|
$ogLiveExitCode = $ogLiveResponse['exitCode'];
|
||||||
|
|
||||||
|
$defaultOglive = null;
|
||||||
|
$installedOglives = [];
|
||||||
|
$ogLiveError = null;
|
||||||
|
|
||||||
if ($ogLiveExitCode !== 0) {
|
if ($ogLiveExitCode !== 0) {
|
||||||
return new JsonResponse(
|
// Capturar el error, pero continuar la ejecución
|
||||||
['error' => 'FAILED_TO_RETRIEVE_OGLIVE_CONFIGURATION', 'details' => $ogLiveConfigResult['error'] ?? 'Unknown error'],
|
$ogLiveError = [
|
||||||
Response::HTTP_INTERNAL_SERVER_ERROR
|
'error' => 'FAILED_TO_RETRIEVE_OGLIVE_CONFIGURATION',
|
||||||
);
|
'details' => $ogLiveConfigResult['error'] ?? 'Unknown error'
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
// Extraer datos si el comando fue exitoso
|
||||||
|
$defaultOglive = $ogLiveConfigResult['default_oglive'] ?? null;
|
||||||
|
$installedOglives = $ogLiveConfigResult['installed_ogLives'] ?? [];
|
||||||
|
if (empty($installedOglives)) {
|
||||||
|
$installedOglives = ['message' => 'No installed ogLives found'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Llamar a oglivecli para obtener el estado de los servicios
|
// Llamar a oglivecli para obtener el estado de los servicios
|
||||||
|
|
@ -164,10 +176,7 @@ public function getStatus(): Response
|
||||||
$installedOglives = $ogLiveConfigResult['installed_ogLives'] ?? [];
|
$installedOglives = $ogLiveConfigResult['installed_ogLives'] ?? [];
|
||||||
|
|
||||||
if ($defaultOglive === null || empty($installedOglives)) {
|
if ($defaultOglive === null || empty($installedOglives)) {
|
||||||
return new JsonResponse(
|
$installedOglives = ['message' => 'No installed ogLives found'];
|
||||||
['error' => 'NOT_FOUND', 'message' => 'No default or installed ogLives found.'],
|
|
||||||
Response::HTTP_NOT_FOUND
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = [
|
$response = [
|
||||||
|
|
@ -180,6 +189,11 @@ public function getStatus(): Response
|
||||||
]
|
]
|
||||||
]; // Formatear la respuesta final con todos los datos
|
]; // Formatear la respuesta final con todos los datos
|
||||||
|
|
||||||
|
// Incluir el error de oglive si existe
|
||||||
|
if ($ogLiveError !== null) {
|
||||||
|
$response['message']['oglive_error'] = $ogLiveError;
|
||||||
|
}
|
||||||
|
|
||||||
return new JsonResponse($response, Response::HTTP_OK);
|
return new JsonResponse($response, Response::HTTP_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue