Show errors during attempted station start/restart.
This commit is contained in:
parent
9d66cff573
commit
be0e9a8912
|
@ -67,11 +67,19 @@ class RestartRadioCommand extends CommandAbstract
|
|||
$io->progressStart(count($stations));
|
||||
|
||||
foreach ($stations as $station) {
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
reloadSupervisor: $noSupervisorRestart,
|
||||
forceRestart: true
|
||||
);
|
||||
try {
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
reloadSupervisor: $noSupervisorRestart,
|
||||
forceRestart: true
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
$io->error([
|
||||
(string)$station,
|
||||
$e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
$io->progressAdvance();
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,12 @@ class CloneAction extends StationsController
|
|||
$newStation = $this->reloadableEm->refetch($newStation);
|
||||
|
||||
$this->configuration->assignRadioPorts($newStation, true);
|
||||
$this->configuration->writeConfiguration($newStation);
|
||||
|
||||
try {
|
||||
$this->configuration->writeConfiguration($newStation);
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
|
||||
return $response->withJson(Entity\Api\Status::created());
|
||||
|
|
|
@ -320,10 +320,13 @@ class StationsController extends AbstractAdminApiCrudController
|
|||
}
|
||||
|
||||
if ($adapter_changed || !$station->getIsEnabled()) {
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
forceRestart: true
|
||||
);
|
||||
try {
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
forceRestart: true
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
}
|
||||
|
||||
return $station;
|
||||
|
|
|
@ -130,10 +130,20 @@ class ServicesController
|
|||
{
|
||||
// Reloading attempts to update configuration without restarting broadcasting, if possible and supported.
|
||||
$station = $request->getStation();
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
forceRestart: true
|
||||
);
|
||||
|
||||
try {
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
forceRestart: true
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
return $response->withJson(
|
||||
new Entity\Api\Error(
|
||||
500,
|
||||
$e->getMessage()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $response->withJson(new Entity\Api\Status(true, __('Station reloaded.')));
|
||||
}
|
||||
|
@ -142,10 +152,21 @@ class ServicesController
|
|||
{
|
||||
// Restarting will always shut down and restart any services.
|
||||
$station = $request->getStation();
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
forceRestart: true
|
||||
);
|
||||
|
||||
try {
|
||||
$this->configuration->writeConfiguration(
|
||||
station: $station,
|
||||
forceRestart: true,
|
||||
attemptReload: false
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
return $response->withJson(
|
||||
new Entity\Api\Error(
|
||||
500,
|
||||
$e->getMessage()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $response->withJson(new Entity\Api\Status(true, __('Station restarted.')));
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ class Configuration
|
|||
|
||||
if (!$station->getIsEnabled()) {
|
||||
$this->unlinkAndStopStation($station, $reloadSupervisor);
|
||||
return;
|
||||
throw new \RuntimeException('Station is disabled.');
|
||||
}
|
||||
|
||||
$frontend = $this->adapters->getFrontendAdapter($station);
|
||||
|
@ -103,7 +103,7 @@ class Configuration
|
|||
// If no processes need to be managed, remove any existing config.
|
||||
if (!$frontend->hasCommand($station) && !$backend->hasCommand($station)) {
|
||||
$this->unlinkAndStopStation($station, $reloadSupervisor);
|
||||
return;
|
||||
throw new \RuntimeException('Station has no local services.');
|
||||
}
|
||||
|
||||
// If using AutoDJ and there is no media, don't spin up services.
|
||||
|
@ -119,7 +119,7 @@ class Configuration
|
|||
|
||||
if (0 === $mediaCount) {
|
||||
$this->unlinkAndStopStation($station, $reloadSupervisor);
|
||||
return;
|
||||
throw new \RuntimeException('Station has no media assigned to playlists.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue