refs #437 Removes /status endpoint and deletes some comments

ogboot_symfony
Luis Gerardo Romero Garcia 2024-06-26 13:02:27 +02:00
parent 30218828f8
commit 1a79772d1d
2 changed files with 1 additions and 42 deletions

View File

@ -124,43 +124,6 @@ public function getConfig(): Response
/**
* @Route("/ogboot/v1/status", name="status", methods={"GET"})
* @OA\Get(
* path="/ogboot/v1/status",
* summary="Get ogboot status",
* @OA\Response(
* response=200,
* description="Successful operation",
* @OA\JsonContent(
* type="object",
* @OA\Property(
* property="message",
* type="string",
* description="Status message indicating any issues detected"
* )
* )
* ),
* @OA\Response(
* response=500,
* description="Failed to retrieve status"
* )
* )
*/
public function status(): Response
{
# $result = $this->curlRequestService->common_request(OG_REST_CMD_POWEROFF, POST, [OG_REST_PARAM_CLIENTS => $ips]);
$result = $this->curlRequestService->callOgLive("check");
if ($result) {
return new Response($result, Response::HTTP_OK);
} else {
return new Response('Failed', Response::HTTP_INTERNAL_SERVER_ERROR);
}
}
/**
* @Route("/ogboot/v1/oglives/isos", name="getDownloadMenu", methods={"GET"})
* @OA\Get(
@ -589,7 +552,7 @@ public function installOglive(Request $request): Response
}
$isoname = $data['isoname'];
$result = $this->curlRequestService->callOgLive("install " . escapeshellarg($isoname));
$result = $this->curlRequestService->callOgLive("download " . escapeshellarg($isoname));
if (is_array($result) && isset($result['success']) && $result['success'] === false) {
return new JsonResponse(['error' => 'Failed to install ogLive client', 'details' => $result['error']], Response::HTTP_INTERNAL_SERVER_ERROR);

View File

@ -69,7 +69,6 @@ public function callOgLive($parameter)
{
$socketPath = '/var/run/oglive/oglive_daemon.sock';
// Registrar el parámetro recibido
file_put_contents('/tmp/serviceOglive.log', 'callOgLive called with parameter: ' . $parameter . PHP_EOL, FILE_APPEND);
$socket = socket_create(AF_UNIX, SOCK_STREAM, 0);
@ -109,7 +108,6 @@ public function callOgLive($parameter)
socket_close($socket);
// Registrar la respuesta en bruto
file_put_contents('/tmp/serviceOglive.log', 'Raw response: ' . $response . PHP_EOL, FILE_APPEND);
if (empty($response)) {
@ -123,7 +121,6 @@ public function callOgLive($parameter)
$decodedResponse = json_decode($response, true);
// Registrar cualquier error de decodificación JSON
if (json_last_error() !== JSON_ERROR_NONE) {
$error = 'Error al decodificar JSON: ' . json_last_error_msg();
file_put_contents('/tmp/serviceOglive.log', 'JSON decode error: ' . $error . PHP_EOL, FILE_APPEND);
@ -134,7 +131,6 @@ public function callOgLive($parameter)
}
if (isset($decodedResponse['success']) && $decodedResponse['success']) {
// Registrar la respuesta decodificada
file_put_contents('/tmp/serviceOglive.log', 'Decoded successful response: ' . json_encode($decodedResponse['output']) . PHP_EOL, FILE_APPEND);
return $decodedResponse['output'];
} else {