Skip to content

Commit

Permalink
generate: fix annotations parse
Browse files Browse the repository at this point in the history
It's valid for values to contain '='.

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
  • Loading branch information
Ma Shimiao committed Jan 17, 2017
1 parent f3499f2 commit 61b1b7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/oci-runtime-tool/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
if context.IsSet("label") {
annotations := context.StringSlice("label")
for _, s := range annotations {
pair := strings.Split(s, "=")
if len(pair) != 2 {
pair := strings.SplitN(s, "=", 2)
if len(pair) != 2 || pair[0] == "" {
return fmt.Errorf("incorrectly specified annotation: %s", s)
}
g.AddAnnotation(pair[0], pair[1])
Expand Down
1 change: 1 addition & 0 deletions man/oci-runtime-tool-generate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ read the configuration from `config.json`.

**--label**=[]
Add annotations to the configuration e.g. key=value.
Currently, key containing equals sign is not supported.

**--linux-cpu-shares**=CPUSHARES
Specifies a relative share of CPU time available to the tasks in a cgroup.
Expand Down

0 comments on commit 61b1b7d

Please sign in to comment.