refs #311 #394 changes oglivecli to take isoname in download

pull/3/head
Luis Gerardo Romero Garcia 2024-05-27 12:15:57 +02:00
parent a13dabc93c
commit 9471f1c6e1
1 changed files with 35 additions and 36 deletions

View File

@ -2,7 +2,6 @@
// src/OgBootBundle/Controller/OgBootController.php // src/OgBootBundle/Controller/OgBootController.php
namespace App\OgBootBundle\Controller; namespace App\OgBootBundle\Controller;
require_once __DIR__ . '/../constants.php';
use OpenApi\Annotations as OA; use OpenApi\Annotations as OA;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use App\OgBootBundle\Service\CurlRequestService; use App\OgBootBundle\Service\CurlRequestService;
@ -468,17 +467,18 @@ Regenerar plantilla - PUT /ogboot/pxe-templates
} }
/** /**
* @Route("/ogboot/oglives/{id}", name="installOglive", methods={"POST"}) * @Route("/ogboot/oglives/{isoName}", name="installOglive", methods={"POST"})
* @OA\Post( * @OA\Post(
* path="/ogboot/oglives/{id}", * path="/ogboot/oglives/{isoName}",
* summary="Install an ogLive client", * summary="Install an ogLive client",
* @OA\Parameter( * @OA\Parameter(
* name="id", * name="isoName",
* in="path", * in="path",
* description="ID of the ogLive client to install", * description="Name of the ogLive ISO to install",
* required=true, * required=true,
* @OA\Schema( * @OA\Schema(
* type="integer" * type="string",
* example="ogLive-focal-5.13.0-27-beta-amd64-r20210706.5b4bf5f.iso"
* ) * )
* ), * ),
* @OA\Response( * @OA\Response(
@ -499,11 +499,10 @@ Regenerar plantilla - PUT /ogboot/pxe-templates
* ) * )
* ) * )
*/ */
public function installOglive(Request $request): Response 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->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) { if ($result) {
return new Response($result, Response::HTTP_OK); return new Response($result, Response::HTTP_OK);