Docker: Fix: show docker updates as 'available' instead of 'unknown' when upgrading from 6.1 to 6.2

This commit is contained in:
Eric Schultz
2015-12-16 13:43:06 -08:00
parent 1e2844a361
commit b54990b00a
2 changed files with 5 additions and 3 deletions

View File

@@ -466,7 +466,7 @@ class DockerUpdate{
// Add :latest tag to image if it's absent
$image = ($image && count(preg_split("#[:\/]#", $image)) < 3) ? "${image}:latest" : $image;
if(isset($updateStatus[$image])) {
if ($updateStatus[$image]['local'] && $updateStatus[$image]['remote']) {
if ($updateStatus[$image]['local'] || $updateStatus[$image]['remote']) {
return ($updateStatus[$image]['local'] == $updateStatus[$image]['remote']) ? true : false;
}
}

View File

@@ -45,8 +45,10 @@ if (!isset($check)) {
$image = $ct['Image'];
if ($info[$name]['updated'] == "false") {
$updateStatus = (is_file($dockerManPaths['update-status'])) ? json_decode(file_get_contents($dockerManPaths['update-status']), TRUE) : array();
$new = $updateStatus[$image]['remote'];
exec("$notify -e 'Docker - $name [$new]' -s 'Notice [$server] - Docker update $new' -d 'A new version of $name is available' -i 'normal $output' -x");
$new = str_replace('sha256:', '', $updateStatus[$image]['remote']);
$new = substr($new, 0, 4).'..'.substr($new, -4, 4);
exec("$notify -e ".escapeshellarg("Docker - $name [$new]")." -s ".escapeshellarg("Notice [$server] - Docker update $new")." -d ".escapeshellarg("A new version of $name is available")." -i ".escapeshellarg("normal $output")." -x");
}
}
}