1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Remove job image_get

Signed-off-by: Antonio Murdaca <me@runcom.ninja>
This commit is contained in:
Antonio Murdaca 2015-04-21 19:42:06 +02:00
parent 6f82613ded
commit d07fe18365
3 changed files with 4 additions and 46 deletions

View file

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

View file

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

View file

@ -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 {