mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00
pkg/machinie: use TZ env for reading local timezone
The TZ var can be commonly used to overwrite the timezone so we should honour that one as well. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -147,11 +147,15 @@ func (ign *DynamicIgnition) GenerateIgnitionConfig() error {
|
|||||||
// local means the same as the host
|
// local means the same as the host
|
||||||
// look up where it is pointing to on the host
|
// look up where it is pointing to on the host
|
||||||
if ign.TimeZone == "local" {
|
if ign.TimeZone == "local" {
|
||||||
|
if env, ok := os.LookupEnv("TZ"); ok {
|
||||||
|
tz = env
|
||||||
|
} else {
|
||||||
tz, err = getLocalTimeZone()
|
tz, err = getLocalTimeZone()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error getting local timezone: %q", err)
|
return fmt.Errorf("error getting local timezone: %q", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// getLocalTimeZone() can return empty string, do not add broken symlink in that case
|
// getLocalTimeZone() can return empty string, do not add broken symlink in that case
|
||||||
// coreos will default to UTC
|
// coreos will default to UTC
|
||||||
if tz == "" {
|
if tz == "" {
|
||||||
|
Reference in New Issue
Block a user