use args
This commit is contained in:
parent
930ec9f52c
commit
4b5ceb0f24
3 changed files with 7 additions and 11 deletions
3
api.go
3
api.go
|
@ -378,10 +378,9 @@ func postCommit(srv *Server, version float64, w http.ResponseWriter, r *http.Req
|
|||
utils.Errorf("%s", err)
|
||||
}
|
||||
|
||||
job := srv.Eng.Job("commit")
|
||||
job := srv.Eng.Job("commit", r.Form.Get("container"))
|
||||
job.Setenv("repo", r.Form.Get("repo"))
|
||||
job.Setenv("tag", r.Form.Get("tag"))
|
||||
job.Setenv("container", r.Form.Get("container"))
|
||||
job.Setenv("author", r.Form.Get("author"))
|
||||
job.Setenv("comment", r.Form.Get("comment"))
|
||||
job.SetenvJson("config", config)
|
||||
|
|
|
@ -155,8 +155,7 @@ func TestCommit(t *testing.T) {
|
|||
|
||||
id := createTestContainer(eng, config, t)
|
||||
|
||||
job := eng.Job("commit")
|
||||
job.Setenv("container", id)
|
||||
job := eng.Job("commit", id)
|
||||
job.Setenv("repo", "testrepo")
|
||||
job.Setenv("tag", "testtag")
|
||||
job.SetenvJson("config", config)
|
||||
|
@ -268,8 +267,7 @@ func TestRmi(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
job = eng.Job("commit")
|
||||
job.Setenv("container", containerID)
|
||||
job = eng.Job("commit", containerID)
|
||||
job.Setenv("repo", "test")
|
||||
var imageID string
|
||||
job.Stdout.AddString(&imageID)
|
||||
|
@ -296,8 +294,7 @@ func TestRmi(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
job = eng.Job("commit")
|
||||
job.Setenv("container", containerID)
|
||||
job = eng.Job("commit", containerID)
|
||||
job.Setenv("repo", "test")
|
||||
if err := job.Run(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
@ -774,11 +774,11 @@ func createAPIContainer(names []string, container *Container, size bool, runtime
|
|||
return c
|
||||
}
|
||||
func (srv *Server) ContainerCommit(job *engine.Job) engine.Status {
|
||||
if len(job.Args) != 0 {
|
||||
job.Errorf("Usage: %s\n", job.Name)
|
||||
if len(job.Args) != 1 {
|
||||
job.Errorf("Not enough arguments. Usage: %s CONTAINER\n", job.Name)
|
||||
return engine.StatusErr
|
||||
}
|
||||
name := job.Getenv("container")
|
||||
name := job.Args[0]
|
||||
|
||||
container := srv.runtime.Get(name)
|
||||
if container == nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue