Skip to content

Commit

Permalink
fix error message from docker inspect
Browse files Browse the repository at this point in the history
Signed-off-by: Anda Xu <anda.xu@docker.com>
  • Loading branch information
AntaresS committed May 21, 2018
1 parent 824ce49 commit 10c9014
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 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 == "" && (apiclient.IsErrNotFound(err) || isErrorSkippable(err)) {
continue
}
return v, raw, err
Expand All @@ -214,3 +210,8 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool,
return nil, nil, errors.Errorf("Error: No such object: %s", ref)
}
}

func isErrorSkippable(err error) bool {
return strings.Contains(err.Error(), "not supported") ||
strings.Contains(err.Error(), "invalid reference format")
}

0 comments on commit 10c9014

Please sign in to comment.