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;
@ -467,43 +466,43 @@ 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( * ),
* response=200, * @OA\Response(
* description="ogLive client installed successfully", * response=200,
* @OA\JsonContent( * description="ogLive client installed successfully",
* type="object", * @OA\JsonContent(
* @OA\Property(property="message", type="string") * type="object",
* ) * @OA\Property(property="message", type="string")
* ), * )
* @OA\Response( * ),
* response=500, * @OA\Response(
* description="Failed to install ogLive client", * response=500,
* @OA\JsonContent( * description="Failed to install ogLive client",
* type="object", * @OA\JsonContent(
* @OA\Property(property="error", type="string") * type="object",
* ) * @OA\Property(property="error", type="string")
* ) * )
* ) * )
*/ * )
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);