mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
Merge pull request #4066 from nextcloud/enh/4056/fix-image-check
only check if the image is actually there if no image is there
This commit is contained in:
commit
2c951a784b
1 changed files with 9 additions and 2 deletions
|
|
@ -582,14 +582,21 @@ class DockerActionManager
|
||||||
$imageName = $this->BuildImageName($container);
|
$imageName = $this->BuildImageName($container);
|
||||||
$encodedImageName = urlencode($imageName);
|
$encodedImageName = urlencode($imageName);
|
||||||
$url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', $encodedImageName));
|
$url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', $encodedImageName));
|
||||||
|
$imageIsThere = true;
|
||||||
try {
|
try {
|
||||||
$this->guzzleClient->post($url);
|
|
||||||
$imageUrl = $this->BuildApiUrl(sprintf('images/%s/json', $encodedImageName));
|
$imageUrl = $this->BuildApiUrl(sprintf('images/%s/json', $encodedImageName));
|
||||||
$this->guzzleClient->get($imageUrl)->getBody()->getContents();
|
$this->guzzleClient->get($imageUrl)->getBody()->getContents();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
$imageIsThere = false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
$this->guzzleClient->post($url);
|
||||||
|
} catch (RequestException $e) {
|
||||||
|
if ($imageIsThere === false) {
|
||||||
throw new \Exception("Could not pull image " . $imageName . ". Please run 'sudo docker exec -it nextcloud-aio-mastercontainer docker pull " . $imageName . "' in order to find out why it failed.");
|
throw new \Exception("Could not pull image " . $imageName . ". Please run 'sudo docker exec -it nextcloud-aio-mastercontainer docker pull " . $imageName . "' in order to find out why it failed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function isContainerUpdateAvailable(string $id) : string
|
private function isContainerUpdateAvailable(string $id) : string
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue