refs #952. First revision status endpoint ogAgent
testing/ogcore-api/pipeline/head Something is wrong with the build of this commit Details

develop-jenkins
Manuel Aranda Rosales 2024-10-22 21:36:38 +02:00
parent 31750fe663
commit 4aa03d643e
3 changed files with 15 additions and 7 deletions

View File

@ -46,14 +46,13 @@ class StatusAction extends AbstractController
try {
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/ogAdmClient/status');
} catch (TransportExceptionInterface $e) {
$client->setStatus('off');
$this->entityManager->persist($client);
$this->entityManager->flush();
} catch (TransportExceptionInterface $e) {
return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR);
}
$client->setStatus('active');
$this->entityManager->persist($client);
$this->entityManager->flush();

View File

@ -82,8 +82,17 @@ class InstallOgLiveResponseAction extends AbstractController
$ogLive->setStatus($status === self::OG_LIVE_INSTALL_SUCCESS ? OgLiveStatus::ACTIVE : OgLiveStatus::FAILED);
$ogLive->setInstalled($status === self::OG_LIVE_INSTALL_SUCCESS);
$ogLive->setIsDefault(true);
$this->entityManager->persist($ogLive);
$oldDefaultOgLive = $this->entityManager->getRepository(OgLive::class)->findBy(['isDefault' => true]);
foreach ($oldDefaultOgLive as $oldOgLive) {
$oldOgLive->setIsDefault(false);
$this->entityManager->persist($oldOgLive);
}
$this->entityManager->flush();
}
}

View File

@ -36,16 +36,16 @@ class PostAction extends AbstractOgBootController
'mac' => strtolower($client->getMac()),
'lang' => 'es_ES.UTF_8',
'ip' => $client->getIp(),
'server_ip' => '92.168.2.1',
'server_ip' => '192.168.2.4',
'router' => $client->getOrganizationalUnit()->getNetworkSettings()->getRouter(),
'netmask' => $client->getOrganizationalUnit()->getNetworkSettings() ? $client->getOrganizationalUnit()->getNetworkSettings()->getNetmask() : '255.255.255.0',
'computer_name' => $client->getName(),
'netiface' => $client->getNetiface(),
'group' => $client->getOrganizationalUnit()->getName(),
'ogrepo' => $client->getRepository() ? $client->getRepository()->getIpAddress() : '192.168.2.1',
'oglive' => $client->getOgLive() ? $client->getOgLive()->getDownloadUrl() : '',
'oglog' => '192.168.2.1',
'ogshare' => '192.168.2.1',
'ogrepo' => $client->getRepository() ? $client->getRepository()->getIpAddress() : '192.168.2.4',
'oglive' => '192.168.2.4',
'oglog' => '192.168.2.4',
'ogshare' => '192.168.2.4',
'oglivedir' => 'ogLive',
'ogprof' => 'false',
'hardprofile' => $client->getHardwareProfile() ? $client->getHardwareProfile()->getDescription() : 'default',