From d07fe1836579b0d55813cae8736be31a2891501a Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Tue, 21 Apr 2015 19:42:06 +0200 Subject: [PATCH] Remove job image_get Signed-off-by: Antonio Murdaca --- graph/export.go | 7 +++---- graph/load.go | 2 +- graph/service.go | 41 ----------------------------------------- 3 files changed, 4 insertions(+), 46 deletions(-) diff --git a/graph/export.go b/graph/export.go index 2450d50273..56b5fba719 100644 --- a/graph/export.go +++ b/graph/export.go @@ -144,12 +144,11 @@ func (s *TagStore) exportImage(eng *engine.Engine, name, tempdir string) error { } // find parent - job = eng.Job("image_get", n) - info, _ := job.Stdout.AddEnv() - if err := job.Run(); err != nil { + img, err := s.LookupImage(n) + if err != nil { return err } - n = info.Get("Parent") + n = img.Parent } return nil } diff --git a/graph/load.go b/graph/load.go index bf2cc6d700..5272eb1394 100644 --- a/graph/load.go +++ b/graph/load.go @@ -80,7 +80,7 @@ func (s *TagStore) CmdLoad(job *engine.Job) error { } func (s *TagStore) recursiveLoad(eng *engine.Engine, address, tmpImageDir string) error { - if err := eng.Job("image_get", address).Run(); err != nil { + if _, err := s.LookupImage(address); err != nil { logrus.Debugf("Loading %s", address) imageJson, err := ioutil.ReadFile(path.Join(tmpImageDir, "repo", address, "json")) diff --git a/graph/service.go b/graph/service.go index 007a57d134..b829b130f6 100644 --- a/graph/service.go +++ b/graph/service.go @@ -12,7 +12,6 @@ import ( func (s *TagStore) Install(eng *engine.Engine) error { for name, handler := range map[string]engine.Handler{ "image_set": s.CmdSet, - "image_get": s.CmdGet, "image_inspect": s.CmdLookup, "image_export": s.CmdImageExport, "viz": s.CmdViz, @@ -73,46 +72,6 @@ func (s *TagStore) CmdSet(job *engine.Job) error { return nil } -// CmdGet returns information about an image. -// If the image doesn't exist, an empty object is returned, to allow -// checking for an image's existence. -func (s *TagStore) CmdGet(job *engine.Job) error { - if len(job.Args) != 1 { - return fmt.Errorf("usage: %s NAME", job.Name) - } - name := job.Args[0] - res := &engine.Env{} - img, err := s.LookupImage(name) - // Note: if the image doesn't exist, LookupImage returns - // nil, nil. - if err != nil { - return err - } - if img != nil { - // We don't directly expose all fields of the Image objects, - // to maintain a clean public API which we can maintain over - // time even if the underlying structure changes. - // We should have done this with the Image object to begin with... - // but we didn't, so now we're doing it here. - // - // Fields that we're probably better off not including: - // - Config/ContainerConfig. Those structs have the same sprawl problem, - // so we shouldn't include them wholesale either. - // - Comment: initially created to fulfill the "every image is a git commit" - // metaphor, in practice people either ignore it or use it as a - // generic description field which it isn't. On deprecation shortlist. - res.SetAuto("Created", img.Created) - res.SetJson("Author", img.Author) - res.Set("Os", img.OS) - res.Set("Architecture", img.Architecture) - res.Set("DockerVersion", img.DockerVersion) - res.SetJson("Id", img.ID) - res.SetJson("Parent", img.Parent) - } - res.WriteTo(job.Stdout) - return nil -} - // CmdLookup return an image encoded in JSON func (s *TagStore) CmdLookup(job *engine.Job) error { if len(job.Args) != 1 {