Skip to content

Commit efa4028

Browse files
address comments
1 parent 5742fc8 commit efa4028

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

cmd/clusterctl/pkg/client/repository/client.go

+10-3
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,21 @@ func getLocalOverride(provider config.Provider, version, path string) ([]byte, e
166166
homeFolder := filepath.Join(homedir.HomeDir(), config.ConfigFolder)
167167
overridePath := filepath.Join(homeFolder, overrideFolder, provider.Name(), version, path)
168168

169-
// it the local override exists use it, otherwise read from the repository
170-
if _, err := os.Stat(overridePath); err == nil {
169+
// it the local override exists, use it
170+
_, err := os.Stat(overridePath)
171+
if err == nil {
171172
content, err := ioutil.ReadFile(overridePath)
172173
if err != nil {
173174
return nil, errors.Wrapf(err, "failed to read local override for %s/%s/%s", provider.Name(), version, path)
174175
}
175176
return content, nil
176177
}
177178

178-
return nil, nil
179+
// it the local override does not exists, return (so files from the provider's repository could be used)
180+
if os.IsNotExist(err) {
181+
return nil, nil
182+
}
183+
184+
// blocks for any other error
185+
return nil, err
179186
}

cmd/clusterctl/pkg/client/repository/components_client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (f *componentsClient) Get(version, targetNamespace, watchingNamespace strin
6464
if file == nil {
6565
file, err = f.repository.GetFile(version, path)
6666
if err != nil {
67-
return nil, errors.Wrapf(err, "failed to read %q from the repository for provider %q", path, f.provider.Name())
67+
return nil, errors.Wrapf(err, "failed to read %q from provider's repository %q", path, f.provider.Name())
6868
}
6969
}
7070

0 commit comments

Comments
 (0)