Skip to content

Commit 22ea669

Browse files
committed
clusterctl: fix fallback to overrides directory in home when there is no overrides directory in XDG directory
1 parent 76dd080 commit 22ea669

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cmd/clusterctl/client/repository/overrides.go

Lines changed: 7 additions & 0 deletions
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)