Fix inspect object by invalid reference

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2016-12-23 22:57:30 -08:00
Родитель a9fa38b1ed
Коммит 3cd39aaeab
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -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")
}

Просмотреть файл

@ -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())