Skip to content

Commit 9e1693f

Browse files
authored
Merge pull request #11824 from chrischdi/pr-fixup-clusterctl-overrides-fallback
🌱 clusterctl: fix fallback to overrides directory in home when there is no overrides directory in XDG directory
2 parents 9a55766 + 22ea669 commit 9e1693f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/clusterctl/client/repository/overrides.go

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ func (o *overrides) Path() (string, error) {
7474
return "", err
7575
}
7676
basepath := filepath.Join(configDirectory, overrideFolder)
77+
// Fallback to the .cluster-api directory in home if the above does not exist.
78+
if _, err := os.Stat(basepath); os.IsNotExist(err) {
79+
fallbackBasepath := filepath.Join(xdg.Home, config.ConfigFolder, overrideFolder)
80+
if _, err := os.Stat(fallbackBasepath); err == nil {
81+
basepath = fallbackBasepath
82+
}
83+
}
7784
f, err := o.configVariablesClient.Get(overrideFolderKey)
7885
if err == nil && strings.TrimSpace(f) != "" {
7986
basepath = f

0 commit comments

Comments
 (0)