Skip to content

Commit e0c38e2

Browse files
nerakhonsmira
authored andcommitted
fix: update path handling on talosctl cgroups
The call to filepath.join in current code causes breakage when using talosctl on windows due to wrong slash introduced into the embed path. Signed-off-by: Jan Paul <paulj@nerakhon.cz> (cherry picked from commit c8800b4)
1 parent ca2d4c1 commit e0c38e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/talosctl/cmd/talos/cgroupsprinter/presets.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package cgroupsprinter
77
import (
88
"embed"
99
"io/fs"
10+
"path"
1011
"path/filepath"
1112
"slices"
1213
"strings"
@@ -37,7 +38,8 @@ func GetPresetNames() []string {
3738

3839
// GetPreset returns the preset by name.
3940
func GetPreset(name string) Schema {
40-
f, err := presetsFS.Open(filepath.Join("presets", name+".yaml"))
41+
// embed.FS always uses / as separator, even on Windows, we need OS-agnostic path joining here
42+
f, err := presetsFS.Open(path.Join("presets", name+".yaml"))
4143
if err != nil {
4244
panic(err) // should not fail
4345
}

0 commit comments

Comments
 (0)