mirror of
https://github.com/containers/podman.git
synced 2025-06-25 12:20:42 +08:00
Merge pull request #12951 from rhatdan/commit
Fix #2 for compat commit handling of --changes
This commit is contained in:
@ -97,13 +97,13 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)
|
runtime := r.Context().Value(api.RuntimeKey).(*libpod.Runtime)
|
||||||
|
|
||||||
query := struct {
|
query := struct {
|
||||||
Author string `schema:"author"`
|
Author string `schema:"author"`
|
||||||
Changes string `schema:"changes"`
|
Changes []string `schema:"changes"`
|
||||||
Comment string `schema:"comment"`
|
Comment string `schema:"comment"`
|
||||||
Container string `schema:"container"`
|
Container string `schema:"container"`
|
||||||
Pause bool `schema:"pause"`
|
Pause bool `schema:"pause"`
|
||||||
Repo string `schema:"repo"`
|
Repo string `schema:"repo"`
|
||||||
Tag string `schema:"tag"`
|
Tag string `schema:"tag"`
|
||||||
// fromSrc string # fromSrc is currently unused
|
// fromSrc string # fromSrc is currently unused
|
||||||
}{
|
}{
|
||||||
Tag: "latest",
|
Tag: "latest",
|
||||||
@ -138,8 +138,8 @@ func CommitContainer(w http.ResponseWriter, r *http.Request) {
|
|||||||
options.Message = query.Comment
|
options.Message = query.Comment
|
||||||
options.Author = query.Author
|
options.Author = query.Author
|
||||||
options.Pause = query.Pause
|
options.Pause = query.Pause
|
||||||
if query.Changes != "" {
|
for _, change := range query.Changes {
|
||||||
options.Changes = strings.Split(query.Changes, ",")
|
options.Changes = append(options.Changes, strings.Split(change, "\n")...)
|
||||||
}
|
}
|
||||||
ctr, err := runtime.LookupContainer(query.Container)
|
ctr, err := runtime.LookupContainer(query.Container)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -434,7 +434,7 @@ cid=$(jq -r '.Id' <<<"$output")
|
|||||||
t POST "commit?container=nonesuch" 404
|
t POST "commit?container=nonesuch" 404
|
||||||
|
|
||||||
cparam="repo=newrepo&tag=v3&comment=abcd&author=eric"
|
cparam="repo=newrepo&tag=v3&comment=abcd&author=eric"
|
||||||
cparam="$cparam&format=docker&changes=CMD=/bin/bar,EXPOSE=9090"
|
cparam="$cparam&format=docker&changes=CMD%20/bin/bar%0aEXPOSE%209090"
|
||||||
t POST "commit?container=${cid:0:12}&$cparam" 201 \
|
t POST "commit?container=${cid:0:12}&$cparam" 201 \
|
||||||
.Id~[0-9a-f]\\{64\\}
|
.Id~[0-9a-f]\\{64\\}
|
||||||
iid=$(jq -r '.Id' <<<"$output")
|
iid=$(jq -r '.Id' <<<"$output")
|
||||||
|
Reference in New Issue
Block a user