Merge pull request #29681 from tonistiigi/fix-invalid-inspect

Fix inspect object by invalid reference
This commit is contained in:
Vincent Demeester 2016-12-26 13:09:32 +01:00 committed by GitHub
commit 11eb9b0d26
2 changed files with 9 additions and 1 deletions

View file

@ -456,3 +456,11 @@ func (s *DockerSuite) TestInspectUnknownObject(c *check.C) {
c.Assert(out, checker.Contains, "Error: No such object: foobar")
c.Assert(err.Error(), checker.Contains, "Error: No such object: foobar")
}
func (s *DockerSuite) TestInpectInvalidReference(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")
}

View file

@ -232,7 +232,7 @@ func (ps *Store) resolvePluginID(idOrName string) (string, error) {
ref, err := reference.ParseNamed(idOrName)
if err != nil {
return "", errors.Wrapf(err, "failed to parse %v", idOrName)
return "", errors.WithStack(ErrNotFound(idOrName))
}
if _, ok := ref.(reference.Canonical); ok {
logrus.Warnf("canonical references cannot be resolved: %v", ref.String())