Skip to content

Commit

Permalink
Merge pull request #3774 from nextcloud/enh/3769/make-pull-image-fail…
Browse files Browse the repository at this point in the history
…ure-proof
  • Loading branch information
szaimen authored Nov 23, 2023
2 parents 8c17fa0 + 10a8f5b commit 8b39a5e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions php/src/Docker/DockerActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,9 +579,15 @@ public function CreateContainer(Container $container) : void {

public function PullImage(Container $container) : void
{
$url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', urlencode($this->BuildImageName($container))));
// do not catch any exception so that it always throws and logs the error
$this->guzzleClient->post($url);
$imageName = urlencode($this->BuildImageName($container));
$url = $this->BuildApiUrl(sprintf('images/create?fromImage=%s', $imageName));
try {
$this->guzzleClient->post($url);
$imageUrl = $this->BuildApiUrl(sprintf('images/%s/json', $imageName));
$this->guzzleClient->get($imageUrl)->getBody()->getContents();
} catch (\Throwable $e) {
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
Expand Down

0 comments on commit 8b39a5e

Please sign in to comment.