ref(helm): add default repository on init step

See #718
pull/720/head
Michelle Noorali 9 years ago
parent 57c9861116
commit 4b5eef90a1

@ -19,6 +19,8 @@ var (
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() {

@ -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 {

Loading…
Cancel
Save