Closes #9311 Handles container id/name collisions against daemon functionalities according to #8069

Signed-off-by: Andrew C. Bodine <acbodine@us.ibm.com>
This commit is contained in:
Andrew C. Bodine
2014-12-16 15:06:35 -08:00
parent fcc4abc870
commit d25a65375c
32 changed files with 478 additions and 310 deletions

View File

@@ -15,13 +15,13 @@ func (daemon *Daemon) ContainerRestart(job *engine.Job) engine.Status {
if job.EnvExists("t") {
t = job.GetenvInt("t")
}
if container := daemon.Get(name); container != nil {
if err := container.Restart(int(t)); err != nil {
return job.Errorf("Cannot restart container %s: %s\n", name, err)
}
container.LogEvent("restart")
} else {
return job.Errorf("No such container: %s\n", name)
container, err := daemon.Get(name)
if err != nil {
return job.Error(err)
}
if err := container.Restart(int(t)); err != nil {
return job.Errorf("Cannot restart container %s: %s\n", name, err)
}
container.LogEvent("restart")
return engine.StatusOK
}