Updated softwareProfile end of line
testing/ogcore-api/pipeline/tag This commit looks good Details

composer-install opengnsys_devel-0.0.14
Manuel Aranda Rosales 2024-11-27 08:57:39 +01:00
parent c0f825f937
commit 82c42f04f5
1 changed files with 7 additions and 3 deletions

View File

@ -89,7 +89,11 @@ class ClientsController extends AbstractController
$this->logger->info('Starting software profile creation. ', ['image' => (string) $image->getUuid()]);
$this->createSoftwareProfile($data['inv_sft'], $image);
$this->logger->info('Start aux files ogrepo API ', ['image' => (string) $image->getUuid()]);
$this->createAuxFilesAction->__invoke($image);
try {
$this->createAuxFilesAction->__invoke($image);
} catch (\Exception $e) {
$this->logger->error('Error creating aux files', ['image' => (string) $image->getUuid(), 'error' => $e->getMessage()]);
}
$this->logger->info('End aux files ogrepo API ', ['image' => (string) $image->getUuid()]);
} else {
$trace->setStatus(TraceStatus::FAILED);
@ -127,14 +131,14 @@ class ClientsController extends AbstractController
$this->entityManager->flush();
}
return new JsonResponse([], Response::HTTP_OK);
return new JsonResponse(data: 'Webhook finished', status: Response::HTTP_OK);
}
public function createSoftwareProfile(string $base64Data, Image $image): void
{
$decodedData = base64_decode($base64Data);
$this->logger->info('Software profile decoded', ['data' => '']);
$softwareList = array_map('trim', explode(",", $decodedData));
$softwareList = array_map('trim', explode("\n", $decodedData));
$softwareList = array_filter($softwareList);
$existingSoftware = $this->entityManager->getRepository(Software::class)->findBy(['name' => $softwareList]);
$existingNames = array_map(fn($software) => $software->getName(), $existingSoftware);