diff options
author | Brent Baude <bbaude@redhat.com> | 2021-12-14 14:16:09 -0600 |
---|---|---|
committer | Brent Baude <bbaude@redhat.com> | 2021-12-16 12:40:20 -0600 |
commit | a86495ea6fdd56519afc65586c0f7f9c0f4f5ab2 (patch) | |
tree | bdf7576ddf565cf60b889bc7fd825b40ec6376e5 /cmd | |
parent | 273da42af237dde44d34d215dfafa33f0b76d9ab (diff) | |
download | podman-a86495ea6fdd56519afc65586c0f7f9c0f4f5ab2.tar.gz podman-a86495ea6fdd56519afc65586c0f7f9c0f4f5ab2.tar.bz2 podman-a86495ea6fdd56519afc65586c0f7f9c0f4f5ab2.zip |
Set machine timezone
Added an option to podman machine init to declare the timezone of the
resulting machine. the default is to use the value of the host name or
else a given timezone name like America/Chicago.
Fixes: #11895
Signed-off-by: Brent Baude <bbaude@redhat.com>
[NO NEW TESTS NEEDED]
Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/machine/init.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/podman/machine/init.go b/cmd/podman/machine/init.go index adde887f7..bee6844df 100644 --- a/cmd/podman/machine/init.go +++ b/cmd/podman/machine/init.go @@ -38,7 +38,6 @@ func init() { }) flags := initCmd.Flags() cfg := registry.PodmanConfig() - cpusFlagName := "cpus" flags.Uint64Var( &initOpts.CPUS, @@ -69,6 +68,13 @@ func init() { "now", false, "Start machine now", ) + timezoneFlagName := "timezone" + defaultTz := cfg.TZ() + if len(defaultTz) < 1 { + defaultTz = "local" + } + flags.StringVar(&initOpts.TimeZone, timezoneFlagName, defaultTz, "Set timezone") + _ = initCmd.RegisterFlagCompletionFunc(timezoneFlagName, completion.AutocompleteDefault) ImagePathFlagName := "image-path" flags.StringVar(&initOpts.ImagePath, ImagePathFlagName, cfg.Machine.Image, "Path to qcow image") |