diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2019-04-16 06:26:47 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2019-04-17 15:44:50 -0400 |
commit | 6b3d4abb07bd15f6ca2c2f1dc007c325b9cc0dc4 (patch) | |
tree | 3de71a729e637b94a4dc2e802b7f84f3692afc99 /cmd/podman | |
parent | bf5ffdafb40f32fac891a8cd5fc64cfd5b77674f (diff) | |
download | podman-6b3d4abb07bd15f6ca2c2f1dc007c325b9cc0dc4.tar.gz podman-6b3d4abb07bd15f6ca2c2f1dc007c325b9cc0dc4.tar.bz2 podman-6b3d4abb07bd15f6ca2c2f1dc007c325b9cc0dc4.zip |
Fix podman command --change CMD
Currently in Docker if you commit with --change 'CMD a b c'
The command that gets added is
[/bin/sh -c "a b c"]
If you commit --change 'CMD ["a","b","c"]'
You get
[a b c]
This patch set makes podman match this behaviour.
Similar change required for Entrypoint.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/commit.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/podman/commit.go b/cmd/podman/commit.go index 5963f8686..8d79c1e28 100644 --- a/cmd/podman/commit.go +++ b/cmd/podman/commit.go @@ -42,7 +42,7 @@ func init() { commitCommand.SetHelpTemplate(HelpTemplate()) commitCommand.SetUsageTemplate(UsageTemplate()) flags := commitCommand.Flags() - flags.StringSliceVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(libpod.ChangeCmds, " | "))) + flags.StringArrayVarP(&commitCommand.Change, "change", "c", []string{}, fmt.Sprintf("Apply the following possible instructions to the created image (default []): %s", strings.Join(libpod.ChangeCmds, " | "))) flags.StringVarP(&commitCommand.Format, "format", "f", "oci", "`Format` of the image manifest and metadata") flags.StringVarP(&commitCommand.Message, "message", "m", "", "Set commit message for imported image") flags.StringVarP(&commitCommand.Author, "author", "a", "", "Set the author for the image committed") @@ -83,6 +83,9 @@ func commitCmd(c *cliconfig.CommitValues) error { if c.Flag("change").Changed { for _, change := range c.Change { splitChange := strings.Split(strings.ToUpper(change), "=") + if len(splitChange) == 1 { + splitChange = strings.Split(strings.ToUpper(change), " ") + } if !util.StringInSlice(splitChange[0], libpod.ChangeCmds) { return errors.Errorf("invalid syntax for --change: %s", change) } |