mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #29186 from yongtang/29185-docker-inspect-unknown-object
Fix `docker inspect <unkown object>` issue on Windows
This commit is contained in:
commit
9249b29348
2 changed files with 15 additions and 2 deletions
|
@ -447,3 +447,12 @@ func (s *DockerSuite) TestInspectPlugin(c *check.C) {
|
||||||
c.Assert(err, checker.IsNil)
|
c.Assert(err, checker.IsNil)
|
||||||
c.Assert(out, checker.Contains, pNameWithTag)
|
c.Assert(out, checker.Contains, pNameWithTag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test case for 29185
|
||||||
|
func (s *DockerSuite) TestInspectUnknownObject(c *check.C) {
|
||||||
|
// This test should work on both Windows and Linux
|
||||||
|
out, _, err := dockerCmdWithError("inspect", "foobar")
|
||||||
|
c.Assert(err, checker.NotNil)
|
||||||
|
c.Assert(out, checker.Contains, "Error: No such object: foobar")
|
||||||
|
c.Assert(err.Error(), checker.Contains, "Error: No such object: foobar")
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ package plugin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
@ -24,8 +25,11 @@ func (pm *Manager) Enable(name string, config *types.PluginEnableConfig) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inspect examines a plugin config
|
// Inspect examines a plugin config
|
||||||
func (pm *Manager) Inspect(name string) (tp types.Plugin, err error) {
|
func (pm *Manager) Inspect(refOrID string) (tp types.Plugin, err error) {
|
||||||
return tp, errNotSupported
|
// Even though plugin is not supported, we still want to return `not found`
|
||||||
|
// error so that `docker inspect` (without `--type` specified) returns correct
|
||||||
|
// `not found` message
|
||||||
|
return tp, fmt.Errorf("no such plugin name or ID associated with %q", refOrID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Privileges pulls a plugin config and computes the privileges required to install it.
|
// Privileges pulls a plugin config and computes the privileges required to install it.
|
||||||
|
|
Loading…
Add table
Reference in a new issue