feat: monitor server connection
This commit is contained in:
@@ -8,8 +8,8 @@ function format_docker_command_output_to_json($rawOutput): Collection
|
||||
$outputLines = explode(PHP_EOL, $rawOutput);
|
||||
|
||||
return collect($outputLines)
|
||||
->reject(fn ($line) => empty($line))
|
||||
->map(fn ($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
|
||||
->reject(fn($line) => empty($line))
|
||||
->map(fn($outputLine) => json_decode($outputLine, true, flags: JSON_THROW_ON_ERROR));
|
||||
}
|
||||
|
||||
function format_docker_labels_to_json($rawOutput): Collection
|
||||
@@ -17,7 +17,7 @@ function format_docker_labels_to_json($rawOutput): Collection
|
||||
$outputLines = explode(PHP_EOL, $rawOutput);
|
||||
|
||||
return collect($outputLines)
|
||||
->reject(fn ($line) => empty($line))
|
||||
->reject(fn($line) => empty($line))
|
||||
->map(function ($outputLine) {
|
||||
$outputArray = explode(',', $outputLine);
|
||||
return collect($outputArray)
|
||||
@@ -45,6 +45,7 @@ function format_docker_envs_to_json($rawOutput)
|
||||
|
||||
function get_container_status(Server $server, string $container_id, bool $all_data = false, bool $throwError = false)
|
||||
{
|
||||
check_server_connection($server);
|
||||
$container = instant_remote_process(["docker inspect --format '{{json .}}' {$container_id}"], $server, $throwError);
|
||||
if (!$container) {
|
||||
return 'exited';
|
||||
|
Reference in New Issue
Block a user