Skip to content

Commit

Permalink
Merge pull request #1071 from AntaresS/fix-inspect-error
Browse files Browse the repository at this point in the history
fix error message from docker inspect
  • Loading branch information
thaJeztah authored May 21, 2018
2 parents 824ce49 + d209043 commit 26123be
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cli/command/system/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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")
}

0 comments on commit 26123be

Please sign in to comment.