mirror of https://github.com/docker/cli.git
Fix `docker plugin inspect <unkown object>` issue on Windows
This fix is a follow up for comment: https://github.com/docker/docker/pull/29186/files#r91277345 While #29186 addresses the issue of `docker inspect <unknown object>` on Windows, it actually makes `docker plugin inspect <unknown object>` out `object not found` on Windows as well. This is actually misleading as plugin is not supported on Windows. This fix reverted the change in #29186 while at the same time, checks `not supported` in `docker inspect <unknown object>` so that - `docker plugin inspect <unknown object>` returns `not supported` on Windows - `docker inspect <unknown object>` returns `not found` on Windows This fix is related to #29186 and #29185. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
df760c86cf
commit
86a07d3fec
|
@ -2,6 +2,7 @@ package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
|
|
||||||
|
@ -156,6 +157,10 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool,
|
||||||
return info.Swarm.ControlAvailable
|
return info.Swarm.ControlAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isErrNotSupported := func(err error) bool {
|
||||||
|
return strings.Contains(err.Error(), "not supported")
|
||||||
|
}
|
||||||
|
|
||||||
return func(ref string) (interface{}, []byte, error) {
|
return func(ref string) (interface{}, []byte, error) {
|
||||||
const (
|
const (
|
||||||
swarmSupportUnknown = iota
|
swarmSupportUnknown = iota
|
||||||
|
@ -183,7 +188,7 @@ func inspectAll(ctx context.Context, dockerCli *command.DockerCli, getSize bool,
|
||||||
}
|
}
|
||||||
v, raw, err := inspectData.objectInspector(ref)
|
v, raw, err := inspectData.objectInspector(ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if typeConstraint == "" && apiclient.IsErrNotFound(err) {
|
if typeConstraint == "" && (apiclient.IsErrNotFound(err) || isErrNotSupported(err)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
return v, raw, err
|
return v, raw, err
|
||||||
|
|
Loading…
Reference in New Issue