2014-07-31 17:17:50 -04:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/docker/docker/engine"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (daemon *Daemon) ContainerChanges(job *engine.Job) engine.Status {
|
|
|
|
if n := len(job.Args); n != 1 {
|
|
|
|
return job.Errorf("Usage: %s CONTAINER", job.Name)
|
|
|
|
}
|
|
|
|
name := job.Args[0]
|
2014-12-16 18:06:35 -05:00
|
|
|
|
|
|
|
container, error := daemon.Get(name)
|
|
|
|
if error != nil {
|
|
|
|
return job.Error(error)
|
|
|
|
}
|
|
|
|
|
|
|
|
outs := engine.NewTable("", 0)
|
|
|
|
changes, err := container.Changes()
|
|
|
|
if err != nil {
|
|
|
|
return job.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, change := range changes {
|
|
|
|
out := &engine.Env{}
|
|
|
|
if err := out.Import(change); err != nil {
|
2014-07-31 17:17:50 -04:00
|
|
|
return job.Error(err)
|
|
|
|
}
|
2014-12-16 18:06:35 -05:00
|
|
|
outs.Add(out)
|
2014-07-31 17:17:50 -04:00
|
|
|
}
|
2014-12-16 18:06:35 -05:00
|
|
|
|
|
|
|
if _, err := outs.WriteListTo(job.Stdout); err != nil {
|
|
|
|
return job.Error(err)
|
|
|
|
}
|
|
|
|
|
2014-07-31 17:17:50 -04:00
|
|
|
return engine.StatusOK
|
|
|
|
}
|