Skip to content

Commit

Permalink
fix #17244: use /etc/timezone where timedatectl is missing on Linux
Browse files Browse the repository at this point in the history
Signed-off-by: nabbisen <nabbisen@scqr.net>
  • Loading branch information
nabbisen committed Jan 29, 2023
1 parent 8fce9dc commit 12d7044
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/machine/ignition_linux.go
@@ -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 12d7044

Please sign in to comment.