From cd4f611810ea512b49ac73009dedaf0bc6f6162f Mon Sep 17 00:00:00 2001 From: Brent Baude Date: Sat, 23 Sep 2023 11:02:54 -0500 Subject: [PATCH] Fix setting timezone on HyperV the timezone was being set with the wrong path separator for hyperv because it was being generated on Windows. Fixes: coreos/fedora-coreos-tracker#1580 Signed-off-by: Brent Baude --- pkg/machine/e2e/init_test.go | 11 +++++------ pkg/machine/ignition.go | 7 +++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/machine/e2e/init_test.go b/pkg/machine/e2e/init_test.go index 2649f9a4fd..3be15d1828 100644 --- a/pkg/machine/e2e/init_test.go +++ b/pkg/machine/e2e/init_test.go @@ -130,12 +130,11 @@ var _ = Describe("podman machine init", func() { Expect(foundMemory).To(BeNumerically(">", 3800000)) Expect(foundMemory).To(BeNumerically("<", 4200000)) - // TODO timezone setting is broken in FCOS rn. It is either ignition or a change in fedora. - // sshTimezone := sshMachine{} - // timezoneSession, err := mb.setName(name).setCmd(sshTimezone.withSSHCommand([]string{"date"})).run() - // Expect(err).ToNot(HaveOccurred()) - // Expect(timezoneSession).To(Exit(0)) - // Expect(timezoneSession.outputToString()).To(ContainSubstring("HST")) + sshTimezone := sshMachine{} + timezoneSession, err := mb.setName(name).setCmd(sshTimezone.withSSHCommand([]string{"date"})).run() + Expect(err).ToNot(HaveOccurred()) + Expect(timezoneSession).To(Exit(0)) + Expect(timezoneSession.outputToString()).To(ContainSubstring("HST")) }) It("machine init with volume", func() { diff --git a/pkg/machine/ignition.go b/pkg/machine/ignition.go index 4bb41376e7..ac457360d1 100644 --- a/pkg/machine/ignition.go +++ b/pkg/machine/ignition.go @@ -127,8 +127,11 @@ func (ign *DynamicIgnition) GenerateIgnitionConfig() error { User: GetNodeUsr("root"), }, LinkEmbedded1: LinkEmbedded1{ - Hard: BoolToPtr(false), - Target: filepath.Join("/usr/share/zoneinfo", tz), + Hard: BoolToPtr(false), + // We always want this value in unix form (/path/to/something) because this is being + // set in the machine OS (always Linux). However, filepath.join on windows will use a "\\" + // separator; therefore we use ToSlash to convert the path to unix style + Target: filepath.ToSlash(filepath.Join("/usr/share/zoneinfo", tz)), }, } ignStorage.Links = append(ignStorage.Links, tzLink)