diff --git a/src/Controller/OgAgent/Webhook/ClientsController.php b/src/Controller/OgAgent/Webhook/ClientsController.php index e3a4f4c..1f236d7 100644 --- a/src/Controller/OgAgent/Webhook/ClientsController.php +++ b/src/Controller/OgAgent/Webhook/ClientsController.php @@ -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);