Merge pull request #1071 from AntaresS/fix-inspect-error

fix error message from docker inspect
This commit is contained in:
Sebastiaan van Stijn 2018-05-21 20:39:59 +02:00 committed by GitHub
commit 26123be73b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -170,10 +170,6 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool,
return info.Swarm.ControlAvailable
}
isErrNotSupported := func(err error) bool {
return strings.Contains(err.Error(), "not supported")
}
return func(ref string) (interface{}, []byte, error) {
const (
swarmSupportUnknown = iota
@ -201,7 +197,7 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool,
}
v, raw, err := inspectData.objectInspector(ref)
if err != nil {
if typeConstraint == "" && (apiclient.IsErrNotFound(err) || isErrNotSupported(err)) {
if typeConstraint == "" && isErrSkippable(err) {
continue
}
return v, raw, err
@ -214,3 +210,9 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool,
return nil, nil, errors.Errorf("Error: No such object: %s", ref)
}
}
func isErrSkippable(err error) bool {
return apiclient.IsErrNotFound(err) ||
strings.Contains(err.Error(), "not supported") ||
strings.Contains(err.Error(), "invalid reference format")
}