refs #952. First revision status endpoint ogAgent
testing/ogcore-api/pipeline/head Something is wrong with the build of this commit
Details
testing/ogcore-api/pipeline/head Something is wrong with the build of this commit
Details
parent
31750fe663
commit
4aa03d643e
|
@ -46,14 +46,13 @@ class StatusAction extends AbstractController
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/ogAdmClient/status');
|
$response = $this->httpClient->request('POST', 'https://'.$client->getIp().':8000/ogAdmClient/status');
|
||||||
|
} catch (TransportExceptionInterface $e) {
|
||||||
$client->setStatus('off');
|
$client->setStatus('off');
|
||||||
$this->entityManager->persist($client);
|
$this->entityManager->persist($client);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
} catch (TransportExceptionInterface $e) {
|
|
||||||
return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR);
|
return new JsonResponse( data: 'An error occurred', status: Response::HTTP_INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$client->setStatus('active');
|
$client->setStatus('active');
|
||||||
$this->entityManager->persist($client);
|
$this->entityManager->persist($client);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
|
@ -82,8 +82,17 @@ class InstallOgLiveResponseAction extends AbstractController
|
||||||
|
|
||||||
$ogLive->setStatus($status === self::OG_LIVE_INSTALL_SUCCESS ? OgLiveStatus::ACTIVE : OgLiveStatus::FAILED);
|
$ogLive->setStatus($status === self::OG_LIVE_INSTALL_SUCCESS ? OgLiveStatus::ACTIVE : OgLiveStatus::FAILED);
|
||||||
$ogLive->setInstalled($status === self::OG_LIVE_INSTALL_SUCCESS);
|
$ogLive->setInstalled($status === self::OG_LIVE_INSTALL_SUCCESS);
|
||||||
|
$ogLive->setIsDefault(true);
|
||||||
|
|
||||||
$this->entityManager->persist($ogLive);
|
$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();
|
$this->entityManager->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -36,16 +36,16 @@ class PostAction extends AbstractOgBootController
|
||||||
'mac' => strtolower($client->getMac()),
|
'mac' => strtolower($client->getMac()),
|
||||||
'lang' => 'es_ES.UTF_8',
|
'lang' => 'es_ES.UTF_8',
|
||||||
'ip' => $client->getIp(),
|
'ip' => $client->getIp(),
|
||||||
'server_ip' => '92.168.2.1',
|
'server_ip' => '192.168.2.4',
|
||||||
'router' => $client->getOrganizationalUnit()->getNetworkSettings()->getRouter(),
|
'router' => $client->getOrganizationalUnit()->getNetworkSettings()->getRouter(),
|
||||||
'netmask' => $client->getOrganizationalUnit()->getNetworkSettings() ? $client->getOrganizationalUnit()->getNetworkSettings()->getNetmask() : '255.255.255.0',
|
'netmask' => $client->getOrganizationalUnit()->getNetworkSettings() ? $client->getOrganizationalUnit()->getNetworkSettings()->getNetmask() : '255.255.255.0',
|
||||||
'computer_name' => $client->getName(),
|
'computer_name' => $client->getName(),
|
||||||
'netiface' => $client->getNetiface(),
|
'netiface' => $client->getNetiface(),
|
||||||
'group' => $client->getOrganizationalUnit()->getName(),
|
'group' => $client->getOrganizationalUnit()->getName(),
|
||||||
'ogrepo' => $client->getRepository() ? $client->getRepository()->getIpAddress() : '192.168.2.1',
|
'ogrepo' => $client->getRepository() ? $client->getRepository()->getIpAddress() : '192.168.2.4',
|
||||||
'oglive' => $client->getOgLive() ? $client->getOgLive()->getDownloadUrl() : '',
|
'oglive' => '192.168.2.4',
|
||||||
'oglog' => '192.168.2.1',
|
'oglog' => '192.168.2.4',
|
||||||
'ogshare' => '192.168.2.1',
|
'ogshare' => '192.168.2.4',
|
||||||
'oglivedir' => 'ogLive',
|
'oglivedir' => 'ogLive',
|
||||||
'ogprof' => 'false',
|
'ogprof' => 'false',
|
||||||
'hardprofile' => $client->getHardwareProfile() ? $client->getHardwareProfile()->getDescription() : 'default',
|
'hardprofile' => $client->getHardwareProfile() ? $client->getHardwareProfile()->getDescription() : 'default',
|
||||||
|
|
Loading…
Reference in New Issue