From 9471f1c6e1b8d5a9084832f2c1e2c13147500bf9 Mon Sep 17 00:00:00 2001 From: lgromero Date: Mon, 27 May 2024 12:15:57 +0200 Subject: [PATCH] refs #311 #394 changes oglivecli to take isoname in download --- .../Controller/OgBootController.php | 71 +++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/src/OgBootBundle/Controller/OgBootController.php b/src/OgBootBundle/Controller/OgBootController.php index 1df8420..fb7734d 100644 --- a/src/OgBootBundle/Controller/OgBootController.php +++ b/src/OgBootBundle/Controller/OgBootController.php @@ -2,7 +2,6 @@ // src/OgBootBundle/Controller/OgBootController.php namespace App\OgBootBundle\Controller; -require_once __DIR__ . '/../constants.php'; use OpenApi\Annotations as OA; use Psr\Log\LoggerInterface; use App\OgBootBundle\Service\CurlRequestService; @@ -467,43 +466,43 @@ Regenerar plantilla - PUT /ogboot/pxe-templates ]); } -/** - * @Route("/ogboot/oglives/{id}", name="installOglive", methods={"POST"}) - * @OA\Post( - * path="/ogboot/oglives/{id}", - * summary="Install an ogLive client", - * @OA\Parameter( - * name="id", - * in="path", - * description="ID of the ogLive client to install", - * required=true, - * @OA\Schema( - * type="integer" - * ) - * ), - * @OA\Response( - * response=200, - * description="ogLive client installed successfully", - * @OA\JsonContent( - * type="object", - * @OA\Property(property="message", type="string") - * ) - * ), - * @OA\Response( - * response=500, - * description="Failed to install ogLive client", - * @OA\JsonContent( - * type="object", - * @OA\Property(property="error", type="string") - * ) - * ) - * ) - */ - public function installOglive(Request $request): Response + /** + * @Route("/ogboot/oglives/{isoName}", name="installOglive", methods={"POST"}) + * @OA\Post( + * path="/ogboot/oglives/{isoName}", + * summary="Install an ogLive client", + * @OA\Parameter( + * name="isoName", + * in="path", + * description="Name of the ogLive ISO to install", + * required=true, + * @OA\Schema( + * type="string", + * example="ogLive-focal-5.13.0-27-beta-amd64-r20210706.5b4bf5f.iso" + * ) + * ), + * @OA\Response( + * response=200, + * description="ogLive client installed successfully", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="message", type="string") + * ) + * ), + * @OA\Response( + * response=500, + * description="Failed to install ogLive client", + * @OA\JsonContent( + * type="object", + * @OA\Property(property="error", type="string") + * ) + * ) + * ) + */ + public function installOglive(string $isoName): Response { - $id = (int) $request->get('id'); # $result = $this->curlRequestService->common_request(OG_REST_CMD_POWEROFF, POST, [OG_REST_PARAM_CLIENTS => $ips]); - $result = $this->curlRequestService->callOgLive("download $id"); + $result = $this->curlRequestService->callOgLive("download $isoName"); if ($result) { return new Response($result, Response::HTTP_OK);