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

do not alter json in docker save

Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
This commit is contained in:
Victor Vieux 2014-06-17 00:06:21 +00:00
parent 8f6162f17b
commit 3e4e8636c1
4 changed files with 5 additions and 4 deletions

View file

@ -855,7 +855,7 @@ func getContainersByName(eng *engine.Engine, version version.Version, w http.Res
}
var job = eng.Job("container_inspect", vars["name"])
if version.LessThan("1.12") {
job.SetenvBool("dirty", true)
job.SetenvBool("raw", true)
}
streamJSON(job, w, false)
return job.Run()
@ -867,7 +867,7 @@ func getImagesByName(eng *engine.Engine, version version.Version, w http.Respons
}
var job = eng.Job("image_inspect", vars["name"])
if version.LessThan("1.12") {
job.SetenvBool("dirty", true)
job.SetenvBool("raw", true)
}
streamJSON(job, w, false)
return job.Run()

View file

@ -15,7 +15,7 @@ func (daemon *Daemon) ContainerInspect(job *engine.Job) engine.Status {
if container := daemon.Get(name); container != nil {
container.Lock()
defer container.Unlock()
if job.GetenvBool("dirty") {
if job.GetenvBool("raw") {
b, err := json.Marshal(&struct {
*Container
HostConfig *runconfig.HostConfig

View file

@ -135,7 +135,7 @@ func (s *TagStore) CmdLookup(job *engine.Job) engine.Status {
}
name := job.Args[0]
if image, err := s.LookupImage(name); err == nil && image != nil {
if job.GetenvBool("dirty") {
if job.GetenvBool("raw") {
b, err := json.Marshal(image)
if err != nil {
return job.Error(err)

View file

@ -433,6 +433,7 @@ func (srv *Server) exportImage(eng *engine.Engine, name, tempdir string) error {
return err
}
job := eng.Job("image_inspect", n)
job.SetenvBool("raw", true)
job.Stdout.Add(json)
if err := job.Run(); err != nil {
return err