diff --git a/cmd/helm/init.go b/cmd/helm/init.go index 2b5e90d94..1aaf8c7f9 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -15,10 +15,12 @@ Kubernetes Cluster and sets up local configuration in $HELM_HOME (default: ~/.he ` var ( - tillerImg string - tillerNamespace string - clientOnly bool - initSkipNamespace bool + tillerImg string + tillerNamespace string + clientOnly bool + initSkipNamespace bool + defaultRepository = "kubernetes-charts" + defaultRepositoryURL = "http://storage.googleapis.com/kubernetes-charts" ) func init() { @@ -96,7 +98,7 @@ func ensureHome() error { if _, err := os.Create(repoFile); err != nil { return err } - if err := insertRepoLine("local", "http://localhost:8879/charts"); err != nil { + if err := addRepository(defaultRepository, defaultRepositoryURL); err != nil { return err } } else if fi.IsDir() { diff --git a/cmd/helm/repo.go b/cmd/helm/repo.go index 6c0119da0..eee3b9a71 100644 --- a/cmd/helm/repo.go +++ b/cmd/helm/repo.go @@ -55,15 +55,10 @@ func runRepoAdd(cmd *cobra.Command, args []string) error { } name, url := args[0], args[1] - if err := repo.DownloadIndexFile(name, url, cacheDirectory(name, "-index.yaml")); err != nil { - return errors.New("Oops! Looks like " + url + " is not a valid chart repository or cannot be reached\n") - } - - if err := insertRepoLine(name, url); err != nil { + if err := addRepository(name, url); err != nil { return err } - - fmt.Println(args[0] + " has been added to your repositories") + fmt.Println(name + " has been added to your repositories") return nil } @@ -114,6 +109,14 @@ func index(dir, url string) error { return chartRepo.Index() } +func addRepository(name, url string) error { + if err := repo.DownloadIndexFile(name, url, cacheDirectory(name, "-index.yaml")); err != nil { + return errors.New("Looks like " + url + " is not a valid chart repository or cannot be reached\n") + } + + return insertRepoLine(name, url) +} + func removeRepoLine(name string) error { r, err := repo.LoadRepositoriesFile(repositoriesFile()) if err != nil {