mirror of
https://github.com/containers/podman.git
synced 2025-06-02 10:46:09 +08:00
podman container clone env patch
podman container clone was failing when env variables had multiple `=` in them. Switch split to splitn resolves #15836 Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
@ -352,7 +352,7 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s
|
|||||||
if conf.Spec.Process != nil && conf.Spec.Process.Env != nil {
|
if conf.Spec.Process != nil && conf.Spec.Process.Env != nil {
|
||||||
env := make(map[string]string)
|
env := make(map[string]string)
|
||||||
for _, entry := range conf.Spec.Process.Env {
|
for _, entry := range conf.Spec.Process.Env {
|
||||||
split := strings.Split(entry, "=")
|
split := strings.SplitN(entry, "=", 2)
|
||||||
if len(split) == 2 {
|
if len(split) == 2 {
|
||||||
env[split[0]] = split[1]
|
env[split[0]] = split[1]
|
||||||
}
|
}
|
||||||
|
@ -308,5 +308,18 @@ var _ = Describe("Podman container clone", func() {
|
|||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
Expect(session.OutputToString()).Should(ContainSubstring("123"))
|
||||||
|
|
||||||
|
session = podmanTest.Podman([]string{"run", "--name", "env_ctr2", "-e", "ENV_TEST=12=3", ALPINE, "printenv", "ENV_TEST"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
|
session = podmanTest.Podman([]string{"container", "clone", "env_ctr2"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
|
session = podmanTest.Podman([]string{"start", "-a", "env_ctr2-clone"})
|
||||||
|
session.WaitWithDefaultTimeout()
|
||||||
|
Expect(session).Should(Exit(0))
|
||||||
|
Expect(session.OutputToString()).Should(ContainSubstring("12=3"))
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user