Skip to content

Commit

Permalink
Merge pull request #17280 from vrothberg/cherry-pick-17264-to-v4.4
Browse files Browse the repository at this point in the history
[v4.4] fix #17244: use /etc/timezone where `timedatectl` is missing on Linux
  • Loading branch information
openshift-merge-robot authored Jan 30, 2023
2 parents 871c67c + 9eb9607 commit 1878d04
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/machine/ignition_linux.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package machine

import (
"errors"
"os"
"os/exec"
"strings"
)

func getLocalTimeZone() (string, error) {
output, err := exec.Command("timedatectl", "show", "--property=Timezone").Output()
if errors.Is(err, exec.ErrNotFound) {
output, err = os.ReadFile("/etc/timezone")
}
if err != nil {
return "", err
}
Expand Down

0 comments on commit 1878d04

Please sign in to comment.