Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit effb4b0

Browse files
committed
Client.Commit: Fix issue that "commit" command line with tag
Current hyperctl commit will get error if command line has tag. The reason is tag should be moved out as a special commit option from repo in hyperctl. Update Client.Commit to handle the issue. Signed-off-by: Hui Zhu <[email protected]>
1 parent 872d4fe commit effb4b0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

client/api/commit.go

+10
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package api
33
import (
44
"encoding/json"
55
"net/url"
6+
"strings"
67

78
"github.com/hyperhq/hyperd/engine"
89
)
@@ -22,7 +23,16 @@ func (cli *Client) Commit(container, repo, author, message string, changes []str
2223
v.Set("pause", "no")
2324
}
2425
v.Set("container", container)
26+
tag := ""
27+
if repo != "" {
28+
s := strings.Split(repo, ":")
29+
if len(s) == 2 {
30+
repo = s[0]
31+
tag = s[1]
32+
}
33+
}
2534
v.Set("repo", repo)
35+
v.Set("tag", tag)
2636
body, _, err := readBody(cli.call("POST", "/container/commit?"+v.Encode(), nil, nil))
2737
if err != nil {
2838
return "", err

0 commit comments

Comments
 (0)