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 <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2023-09-23 11:02:54 -05:00
parent c3ab75ca45
commit cd4f611810
2 changed files with 10 additions and 8 deletions

View File

@ -130,12 +130,11 @@ var _ = Describe("podman machine init", func() {
Expect(foundMemory).To(BeNumerically(">", 3800000)) Expect(foundMemory).To(BeNumerically(">", 3800000))
Expect(foundMemory).To(BeNumerically("<", 4200000)) Expect(foundMemory).To(BeNumerically("<", 4200000))
// TODO timezone setting is broken in FCOS rn. It is either ignition or a change in fedora. sshTimezone := sshMachine{}
// sshTimezone := sshMachine{} timezoneSession, err := mb.setName(name).setCmd(sshTimezone.withSSHCommand([]string{"date"})).run()
// timezoneSession, err := mb.setName(name).setCmd(sshTimezone.withSSHCommand([]string{"date"})).run() Expect(err).ToNot(HaveOccurred())
// Expect(err).ToNot(HaveOccurred()) Expect(timezoneSession).To(Exit(0))
// Expect(timezoneSession).To(Exit(0)) Expect(timezoneSession.outputToString()).To(ContainSubstring("HST"))
// Expect(timezoneSession.outputToString()).To(ContainSubstring("HST"))
}) })
It("machine init with volume", func() { It("machine init with volume", func() {

View File

@ -127,8 +127,11 @@ func (ign *DynamicIgnition) GenerateIgnitionConfig() error {
User: GetNodeUsr("root"), User: GetNodeUsr("root"),
}, },
LinkEmbedded1: LinkEmbedded1{ LinkEmbedded1: LinkEmbedded1{
Hard: BoolToPtr(false), Hard: BoolToPtr(false),
Target: filepath.Join("/usr/share/zoneinfo", tz), // 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) ignStorage.Links = append(ignStorage.Links, tzLink)