release r012 fix CA container existence check

This commit is contained in:
Mikei386
2026-08-21 10:20:46 +02:00
parent 1abd047946
commit 63e401e89e
7 changed files with 16 additions and 12 deletions
+4 -2
View File
@@ -262,8 +262,10 @@ function ca_install(string $template_url, string $name, string $overrides_json,
$template_path = "/boot/config/plugins/dockerMan/templates-user/my-$name.xml";
if (file_exists($template_path)) fail("Template already exists: $name");
$existing = trim(docker_exec('inspect --type container --format {{.Name}} ' . escapeshellarg($name)));
if ($existing !== '' && stripos($existing, 'Error:') !== 0) fail("Container already exists: $name");
$existing = trim(docker_exec(
'ps -a --filter ' . escapeshellarg("name=^/$name$") . ' --format ' . escapeshellarg('{{.Names}}')
));
if (in_array($name, preg_split('/\R/', $existing) ?: [], true)) fail("Container already exists: $name");
$context = stream_context_create(['http' => [
'timeout' => 30,