Merge pull request 'Fixed typo disk logs. Fixed scope in task.' (#107) from develop into main
testing/ogcore-api/pipeline/head There was a failure building this commit Details
ogcore-debian-package/pipeline/head This commit looks good Details

Reviewed-on: #107
pull/108/head^2
Manuel Aranda Rosales 2026-05-06 17:35:25 +02:00
commit 15e9fa796d
2 changed files with 6 additions and 3 deletions

View File

@ -21,6 +21,7 @@ use App\Entity\Trace;
use App\Model\ClientStatus;
use App\Model\CommandTypes;
use App\Model\TraceStatus;
use App\Repository\ClientRepository;
use App\Repository\CommandTaskRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
@ -34,6 +35,7 @@ class RunScheduledCommandTasksCommand extends Command
{
public function __construct(
private readonly CommandTaskRepository $commandTaskRepository,
private readonly ClientRepository $clientRepository,
private readonly EntityManagerInterface $entityManager,
private readonly RunScriptAction $runScriptAction,
private readonly DeployImageAction $deployImageAction,
@ -101,7 +103,8 @@ class RunScheduledCommandTasksCommand extends Command
$scriptParameters = $script->getParameters();
if ($task->getScope() !== 'clients') {
$clients = $task->getOrganizationalUnit()?->getClients();
$ou = $task->getOrganizationalUnit();
$clients = $ou ? $this->clientRepository->findClientsByOrganizationalUnitAndDescendants($ou->getId()) : [];
} else {
$clients = $task->getClients();
}

View File

@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
#[AsController]
class GetDiskLogsAction extends AbstractController
{
private const LOG_DIR = '/var/log/ogClients/';
private const LOG_DIR = '/var/log/ogclients/';
public function __construct(
private readonly LoggerInterface $logger,
@ -29,7 +29,7 @@ class GetDiskLogsAction extends AbstractController
}
$ip = $client->getIp();
$logPath = self::LOG_DIR . $ip . '/clieng.log';
$logPath = self::LOG_DIR . $ip . '/client.log';
if (!file_exists($logPath)) {
throw new NotFoundHttpException(sprintf('No disk log file found for client %s.', $ip));