Skip to content

cmd: accept multi-value volume options and labels - #97

Draft
f-sommerauer wants to merge 1 commit into
openconfig:masterfrom
f-sommerauer:containerz-volume-create-opts
Draft

f-sommerauer wants to merge 1 commit into
openconfig:masterfrom
f-sommerauer:containerz-volume-create-opts

Conversation

@f-sommerauer

Copy link
Copy Markdown
Collaborator

volume create -o and -l were string slice flags, which split every
value on commas, and each item was then split on "=" with parts[1] read
unchecked. -o options=rbind,rslave,ro was split into "options=rbind",
"rslave" and "ro", and the CLI panicked with an index out of range on
"rslave". Mount options such as uid=1000 were turned into separate keys,
and an entry without "=" (e.g. -l foo) also panicked.

  • Use string array flags: each -o/-l is one key=value entry, repeat the
    flag for multiple entries (same as docker volume create -o).
  • Split each entry at the first "=" only, so values may contain "," and
    "=".
  • Return an error for entries without "=" or with an empty key instead
    of panicking.

Behaviour change: several entries in one flag (-o k1=v1,k2=v2, the
form the old help text documented) are no longer split; repeat the flag
instead (-o k1=v1 -o k2=v2), which already worked before.

`volume create -o` and `-l` were string slice flags, which split every
value on commas, and each item was then split on "=" with parts[1] read
unchecked. `-o options=rbind,rslave,ro` was split into "options=rbind",
"rslave" and "ro", and the CLI panicked with an index out of range on
"rslave". Mount options such as uid=1000 were turned into separate keys,
and an entry without "=" (e.g. `-l foo`) also panicked.

- Use string array flags: each -o/-l is one key=value entry, repeat the
  flag for multiple entries (same as `docker volume create -o`).
- Split each entry at the first "=" only, so values may contain "," and
  "=".
- Return an error for entries without "=" or with an empty key instead
  of panicking.

Behaviour change: several entries in one flag (`-o k1=v1,k2=v2`, the
form the old help text documented) are no longer split; repeat the flag
instead (`-o k1=v1 -o k2=v2`), which already worked before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant