refs #311 #394 changes isoName call in install oglive

pull/3/head
Luis Gerardo Romero Garcia 2024-05-28 06:57:11 +02:00
parent 09eb1e1ef0
commit 54c008cb07
1 changed files with 23 additions and 13 deletions

View File

@ -467,19 +467,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(
* @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(
* response=200,
@ -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(