Make a container action tell the truth about what happened
The response was discarded, so a refused stop looked like a completed one, and the payload the card redraws from is cached for 300s with no invalidation — the container carried on showing as running until the once-a-minute writer caught up. Stop now confirms; start still does not.
This commit is contained in:
@@ -92,6 +92,10 @@ if (PHP_SAPI !== 'cli') {
|
||||
|
||||
if (!$name || !$jobFile || !$image) exit(1);
|
||||
|
||||
// Only for vv_cache_clear() below. Required after the CLI guard, so a stray web request is turned
|
||||
// away before this process loads anything at all.
|
||||
require_once dirname(__DIR__) . '/include/config.php';
|
||||
|
||||
function jw(string $f, array $d): void { file_put_contents($f, json_encode($d)); }
|
||||
|
||||
shell_exec('docker pull ' . escapeshellarg($image) . ' 2>&1');
|
||||
@@ -115,6 +119,10 @@ if ($rebuild && is_executable($rebuild)) {
|
||||
$rc = ($rc1 === 0 && $rc2 === 0) ? 0 : 1;
|
||||
}
|
||||
|
||||
// The container was stopped and started to get here whether or not the rebuild reported success,
|
||||
// so the cached container list is out of date either way.
|
||||
vv_cache_clear('monitor');
|
||||
|
||||
jw($jobFile, $rc === 0
|
||||
? ['ok' => true, 'status' => 'done', 'updated' => true, 'message' => 'Updated and rebuilt']
|
||||
: ['ok' => false, 'status' => 'done', 'error' => 'Rebuild failed after pull']
|
||||
|
||||
Reference in New Issue
Block a user