summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-07-06 13:28:20 -0400
committerGitHub <noreply@github.com>2020-07-06 13:28:20 -0400
commit9532509c50113ac9470108e3492e2769bac533e8 (patch)
tree4d691205d2c574b6c7ab6eb3c62937b327898f58 /libpod/options.go
parent9eac75a967e3459b32b1acd220afb49b60f5e5aa (diff)
parent9a1543caec75a7b02dd2ec9a1111756bb1716454 (diff)
downloadpodman-9532509c50113ac9470108e3492e2769bac533e8.tar.gz
podman-9532509c50113ac9470108e3492e2769bac533e8.tar.bz2
podman-9532509c50113ac9470108e3492e2769bac533e8.zip
Merge pull request #6836 from ashley-cui/tzlibpod
Add --tz flag to create, run
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 4038be9b8..c1a8fdbe1 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1525,6 +1525,30 @@ func withSetAnon() VolumeCreateOption {
}
}
+// WithTimezone sets the timezone in the container
+func WithTimezone(path string) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return define.ErrCtrFinalized
+ }
+ if path != "local" {
+ zone := filepath.Join("/usr/share/zoneinfo", path)
+
+ file, err := os.Stat(zone)
+ if err != nil {
+ return err
+ }
+ //We don't want to mount a timezone directory
+ if file.IsDir() {
+ return errors.New("Invalid timezone: is a directory")
+ }
+ }
+
+ ctr.config.Timezone = path
+ return nil
+ }
+}
+
// Pod Creation Options
// WithPodName sets the name of the pod.