feat(repo): Improve error message for missing repositories.yaml

New users to helm don't always run `helm init` (e.g. if their cluster
already has helm installed).  The user's initial interaction with any of
helm's repository commands (e.g. `helm repo list`) will then be an error
message due to a missing repositories.yaml in their local config.

Give the user a little hint about how to fix the error without them having
to hunt through the man/help pages.
pull/3247/head
Mitchel Humpherys 7 years ago
parent 782f855ad9
commit 7417f09293

@ -55,6 +55,13 @@ func NewRepoFile() *RepoFile {
func LoadRepositoriesFile(path string) (*RepoFile, error) {
b, err := ioutil.ReadFile(path)
if err != nil {
if os.IsNotExist(err) {
return nil, fmt.Errorf(
"Couldn't load repositories file (%s).\n"+
"You might need to run `helm init` (or "+
"`helm init --client-only` if tiller is "+
"already installed)", path)
}
return nil, err
}

Loading…
Cancel
Save