aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-08-04 07:38:22 -0400
committerMatthew Heon <matthew.heon@pm.me>2021-08-11 15:28:18 -0400
commit85d5c24ede45d5455d8ddad4ac8c1b714ce2b14a (patch)
treebfc907f64a0ed68b8692a785e45589b225173bf5
parent67bf11e8c8418d06528bf16b184f77e99a738d05 (diff)
downloadpodman-85d5c24ede45d5455d8ddad4ac8c1b714ce2b14a.tar.gz
podman-85d5c24ede45d5455d8ddad4ac8c1b714ce2b14a.tar.bz2
podman-85d5c24ede45d5455d8ddad4ac8c1b714ce2b14a.zip
Handle timezone on server containers.conf
Fixes: https://github.com/containers/podman/issues/11124 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Signed-off-by: Daniel J Walsh <dwalsh@localhost.localdomain> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
-rw-r--r--libpod/runtime_ctr.go4
-rw-r--r--test/e2e/containers_conf_test.go8
2 files changed, 11 insertions, 1 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 31e2d09ce..059f56798 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -353,6 +353,10 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
}
}
+ if ctr.config.Timezone == "" {
+ ctr.config.Timezone = r.config.Containers.TZ
+ }
+
if ctr.restoreFromCheckpoint {
// Remove information about bind mount
// for new container from imported checkpoint
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index 3349b8be3..08fc4e6cc 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -261,10 +261,16 @@ var _ = Describe("Podman run", func() {
It("podman run containers.conf timezone", func() {
//containers.conf timezone set to Pacific/Honolulu
- session := podmanTest.Podman([]string{"run", ALPINE, "date", "+'%H %Z'"})
+ session := podmanTest.Podman([]string{"run", "--tz", "", ALPINE, "date", "+'%H %Z'"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("HST"))
+
+ // verify flag still overrides
+ session = podmanTest.Podman([]string{"run", "--tz", "EST", ALPINE, "date", "+'%H %Z'"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(ContainSubstring("EST"))
})
It("podman run containers.conf umask", func() {