Commit 7417f092 authored by Mitchel Humpherys's avatar Mitchel Humpherys

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.
parent 782f855a
...@@ -55,6 +55,13 @@ func NewRepoFile() *RepoFile { ...@@ -55,6 +55,13 @@ func NewRepoFile() *RepoFile {
func LoadRepositoriesFile(path string) (*RepoFile, error) { func LoadRepositoriesFile(path string) (*RepoFile, error) {
b, err := ioutil.ReadFile(path) b, err := ioutil.ReadFile(path)
if err != nil { 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 return nil, err
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment