mirror of
https://github.com/containers/skopeo.git
synced 2025-08-27 18:49:08 +00:00
Merge pull request #326 from estesp/gracefully-allow-no-tag-list
Allow inspect to work even if tag list blocked
This commit is contained in:
commit
3851d89b17
@ -3,8 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/containers/image/docker"
|
"github.com/containers/image/docker"
|
||||||
"github.com/containers/image/manifest"
|
"github.com/containers/image/manifest"
|
||||||
"github.com/opencontainers/go-digest"
|
"github.com/opencontainers/go-digest"
|
||||||
@ -97,7 +99,13 @@ var inspectCmd = cli.Command{
|
|||||||
outputData.Name = dockerImg.SourceRefFullName()
|
outputData.Name = dockerImg.SourceRefFullName()
|
||||||
outputData.RepoTags, err = dockerImg.GetRepositoryTags()
|
outputData.RepoTags, err = dockerImg.GetRepositoryTags()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error determining repository tags: %v", err)
|
// some registries may decide to block the "list all tags" endpoint
|
||||||
|
// gracefully allow the inspect to continue in this case. Currently
|
||||||
|
// the IBM Bluemix container registry has this restriction.
|
||||||
|
if !strings.Contains(err.Error(), "401") {
|
||||||
|
return fmt.Errorf("Error determining repository tags: %v", err)
|
||||||
|
}
|
||||||
|
logrus.Warnf("Registry disallows tag list retrieval; skipping")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out, err := json.MarshalIndent(outputData, "", " ")
|
out, err := json.MarshalIndent(outputData, "", " ")
|
||||||
|
Loading…
Reference in New Issue
Block a user