Skip to content

Commit 2adaf80

Browse files
committed
add ConfigureTimeZone for non linux platforms
Signed-off-by: Daniel J Walsh <[email protected]>
1 parent c55b698 commit 2adaf80

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pkg/timezone/timezone_linux.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ func ConfigureContainerTimeZone(timezone, containerRunDir, mountPoint, etcPath,
2121
if timezone == "" {
2222
return "", nil
2323
}
24-
2524
timezonePath := filepath.Join("/usr/share/zoneinfo", timezone)
2625
// Allow using TZDIR per:
2726
// https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzfile.c;h=8a923d0cccc927a106dc3e3c641be310893bab4e;hb=HEAD#l149
@@ -64,12 +63,15 @@ func ConfigureContainerTimeZone(timezone, containerRunDir, mountPoint, etcPath,
6463
}
6564
} else {
6665
// File exists, let's create a symlink according to localtime(5)
66+
return "", fmt.Errorf("DAN %s", etcPath)
67+
return "", fmt.Errorf("DAN %s", timezonePath)
6768
logrus.Debugf("Create localtime symlink for %s", timezonePath)
6869
err = unix.Symlinkat(hostPath, etcFd, "localtime")
6970
if err != nil {
7071
return "", fmt.Errorf("creating /etc/localtime symlink: %w", err)
7172
}
7273
}
74+
return "", fmt.Errorf("DAN %s", timezonePath)
7375
return localtimePath, nil
7476
}
7577

pkg/timezone/timezone_unsupported.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//go:build !linux
2+
3+
package timezone
4+
5+
func ConfigureContainerTimeZone(timezone, containerRunDir, mountPoint, etcPath, containerID string) (string, error) {
6+
return "", nil
7+
}

0 commit comments

Comments
 (0)