feat(legacy): disable services check when missing systemctl (#2160)

This commit is contained in:
Jonas L 2022-09-19 11:56:56 +02:00 committed by GitHub
parent 74539f75d8
commit 1edcbc0657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 224 additions and 204 deletions

View File

@ -45,6 +45,11 @@ function checkDatabaseDependencies()
&& in_array('pgsql', $extensions); && in_array('pgsql', $extensions);
} }
function with_systemd()
{
return !empty(shell_exec('which systemctl'));
}
/** /**
* Check that all external services are configured correctly and return an associative * Check that all external services are configured correctly and return an associative
* array with the results. * array with the results.
@ -53,15 +58,20 @@ function checkDatabaseDependencies()
*/ */
function checkExternalServices() function checkExternalServices()
{ {
return [ $result = [
'database' => checkDatabaseConfiguration(), 'database' => checkDatabaseConfiguration(),
'analyzer' => checkAnalyzerService(),
'pypo' => checkPlayoutService(),
'liquidsoap' => checkLiquidsoapService(),
'rabbitmq' => checkRMQConnection(), 'rabbitmq' => checkRMQConnection(),
'celery' => checkCeleryService(),
'api' => checkApiService(),
]; ];
if (with_systemd()) {
$result['analyzer'] = checkAnalyzerService();
$result['pypo'] = checkPlayoutService();
$result['liquidsoap'] = checkLiquidsoapService();
$result['celery'] = checkCeleryService();
$result['api'] = checkApiService();
}
return $result;
} }
/** /**

View File

@ -15,12 +15,15 @@ $postgres = $phpDependencies['postgres'];
$database = $externalServices['database']; $database = $externalServices['database'];
$rabbitmq = $externalServices['rabbitmq']; $rabbitmq = $externalServices['rabbitmq'];
$systemd = with_systemd();
$pypo = $externalServices['pypo']; if ($systemd) {
$liquidsoap = $externalServices['liquidsoap']; $pypo = $externalServices['pypo'];
$analyzer = $externalServices['analyzer']; $liquidsoap = $externalServices['liquidsoap'];
$celery = $externalServices['celery']; $analyzer = $externalServices['analyzer'];
$api = $externalServices['api']; $celery = $externalServices['celery'];
$api = $externalServices['api'];
}
$r1 = array_reduce($phpDependencies, 'booleanReduce', true); $r1 = array_reduce($phpDependencies, 'booleanReduce', true);
$r2 = array_reduce($externalServices, 'booleanReduce', true); $r2 = array_reduce($externalServices, 'booleanReduce', true);
@ -155,6 +158,7 @@ $result = $r1 && $r2;
</td> </td>
<?php } ?> <?php } ?>
</tr> </tr>
<?php if ($systemd) { ?>
<tr class="<?php echo $analyzer ? 'success' : 'danger'; ?>"> <tr class="<?php echo $analyzer ? 'success' : 'danger'; ?>">
<td class="component"> <td class="component">
Media Analyzer Media Analyzer
@ -250,6 +254,7 @@ $result = $r1 && $r2;
</td> </td>
<?php } ?> <?php } ?>
</tr> </tr>
<?php } ?>
</tbody> </tbody>
</table> </table>
</div> </div>

View File

@ -10,11 +10,14 @@ $postgres = $phpDependencies["postgres"];
$database = $externalServices["database"]; $database = $externalServices["database"];
$rabbitmq = $externalServices["rabbitmq"]; $rabbitmq = $externalServices["rabbitmq"];
$pypo = $externalServices["pypo"]; $systemd = with_systemd();
$liquidsoap = $externalServices["liquidsoap"]; if ($systemd) {
$analyzer = $externalServices["analyzer"]; $pypo = $externalServices['pypo'];
$celery = $externalServices['celery']; $liquidsoap = $externalServices['liquidsoap'];
$api = $externalServices['api']; $analyzer = $externalServices['analyzer'];
$celery = $externalServices['celery'];
$api = $externalServices['api'];
}
$r1 = array_reduce($phpDependencies, "booleanReduce", true); $r1 = array_reduce($phpDependencies, "booleanReduce", true);
$r2 = array_reduce($externalServices, "booleanReduce", true); $r2 = array_reduce($externalServices, "booleanReduce", true);
@ -94,6 +97,7 @@ $result = $r1 && $r2;
?> ?>
</td> </td>
</tr> </tr>
<?php if ($systemd) { ?>
<tr> <tr>
<td class="component"> <td class="component">
Media Analyzer Media Analyzer
@ -199,6 +203,7 @@ $result = $r1 && $r2;
?> ?>
</td> </td>
</tr> </tr>
<?php } ?>
</tbody> </tbody>
<tr id="partitions" class="even"> <tr id="partitions" class="even">
<th colspan="5"><?php echo _("Disk Space") ?></th> <th colspan="5"><?php echo _("Disk Space") ?></th>