Let tag-details be more forgiving of a 404

This commit is contained in:
Tianon Gravi 2015-12-14 14:10:37 -08:00
parent a68d4c206f
commit f95b39f921
1 changed files with 7 additions and 0 deletions

View File

@ -82,6 +82,7 @@ sub get_manifest {
my $authorizationHeader = { Authorization => "Bearer $token" };
my $manifestTx = ua_req(get => "https://registry-1.docker.io/v2/$repo/manifests/$tag" => $authorizationHeader);
return () if $manifestTx->res->code == 404; # tag doesn't exist
die "failed to get manifest for $image" unless $manifestTx->success;
return (
$manifestTx->res->headers->header('Docker-Content-Digest'),
@ -166,6 +167,12 @@ while (my $image = shift) {
my ($digest, $manifest) = get_manifest($repo, $tag);
unless (defined $digest && defined $manifest) {
# tag must not exist yet!
say "\n", '**does not exist** (yet?)';
next;
}
print "\n";
say '```console';
say '$ docker pull ' . $repo . '@' . $digest;