From 54c008cb07c5f2716f47edb90523b8f211ac0d76 Mon Sep 17 00:00:00 2001 From: lgromero Date: Tue, 28 May 2024 06:57:11 +0200 Subject: [PATCH] refs #311 #394 changes isoName call in install oglive --- .../Controller/OgBootController.php | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/OgBootBundle/Controller/OgBootController.php b/src/OgBootBundle/Controller/OgBootController.php index fb7734d..96c8c01 100644 --- a/src/OgBootBundle/Controller/OgBootController.php +++ b/src/OgBootBundle/Controller/OgBootController.php @@ -466,19 +466,21 @@ Regenerar plantilla - PUT /ogboot/pxe-templates ]); } - /** - * @Route("/ogboot/oglives/{isoName}", name="installOglive", methods={"POST"}) + /** + * @Route("/ogboot/v1/oglives", name="installOglive", methods={"POST"}) * @OA\Post( - * path="/ogboot/oglives/{isoName}", + * path="/ogboot/v1/oglives", * summary="Install an ogLive client", - * @OA\Parameter( - * name="isoName", - * in="path", - * description="Name of the ogLive ISO to install", + * @OA\RequestBody( * required=true, - * @OA\Schema( - * type="string", - * example="ogLive-focal-5.13.0-27-beta-amd64-r20210706.5b4bf5f.iso" + * @OA\JsonContent( + * type="object", + * @OA\Property( + * property="isoName", + * type="string", + * description="Name of the ogLive ISO to install", + * example="ogLive-focal-5.13.0-27-beta-amd64-r20210706.5b4bf5f.iso" + * ) * ) * ), * @OA\Response( @@ -499,10 +501,17 @@ Regenerar plantilla - PUT /ogboot/pxe-templates * ) * ) */ - public function installOglive(string $isoName): Response + public function installOglive(Request $request): Response { - # $result = $this->curlRequestService->common_request(OG_REST_CMD_POWEROFF, POST, [OG_REST_PARAM_CLIENTS => $ips]); - $result = $this->curlRequestService->callOgLive("download $isoName"); + $data = json_decode($request->getContent(), true); + $isoName = $data['isoName'] ?? null; + #$isoName = $request->get('isoName'); + var_dump($isoName); + if (!$isoName) { + return new Response('ISO name is required', Response::HTTP_BAD_REQUEST); + } + + $result = $this->curlRequestService->callOgLive("download " . escapeshellarg($isoName)); if ($result) { return new Response($result, Response::HTTP_OK); @@ -511,6 +520,7 @@ Regenerar plantilla - PUT /ogboot/pxe-templates } } + /** * @Route("/ogboot/oglives/{id}", name="uninstallOglive", methods={"DELETE"}) * @OA\Delete(