Skip to content

Commit

Permalink
Handle timezone on server containers.conf
Browse files Browse the repository at this point in the history
Fixes: #11124

Signed-off-by: Daniel J Walsh <[email protected]>
Signed-off-by: Daniel J Walsh <[email protected]>
Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Aug 4, 2021
1 parent 3a922cb commit f40a0e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions libpod/runtime_ctr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion test/e2e/containers_conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit f40a0e7

Please sign in to comment.