Remove wrong commit

Signed-off-by: Dong Gang <dong.gang@daocloud.io>
pull/8491/head
Dong Gang 5 years ago
parent 6216bb5817
commit 1a4e456c2c

@ -480,14 +480,31 @@ func (m *Manager) resolveRepoNames(deps []*chart.Dependency) (map[string]string,
if !found { if !found {
repository := dd.Repository repository := dd.Repository
// Add if URL // Add if URL
if _, err := url.ParseRequestURI(repository); err != nil { _, err := url.ParseRequestURI(repository)
return nil, err if err == nil {
reposMap[repository] = repository
continue
} }
missing = append(missing, repository) missing = append(missing, repository)
} }
} }
if len(missing) > 0 { if len(missing) > 0 {
return nil, ErrRepoNotFound{missing} errorMessage := fmt.Sprintf("no repository definition for %s. Please add them via 'helm repo add'", strings.Join(missing, ", "))
// It is common for people to try to enter "stable" as a repository instead of the actual URL.
// For this case, let's give them a suggestion.
containsNonURL := false
for _, repo := range missing {
if !strings.Contains(repo, "//") && !strings.HasPrefix(repo, "@") && !strings.HasPrefix(repo, "alias:") {
containsNonURL = true
}
}
if containsNonURL {
errorMessage += `
Note that repositories must be URLs or aliases. For example, to refer to the "example"
repository, use "https://charts.example.com/" or "@example" instead of
"example". Don't forget to add the repo, too ('helm repo add').`
}
return nil, errors.New(errorMessage)
} }
return reposMap, nil return reposMap, nil
} }

Loading…
Cancel
Save