|
|
@ -22,6 +22,7 @@ import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
|
@ -102,7 +103,7 @@ func newSearchRepoCmd(out io.Writer) *cobra.Command {
|
|
|
|
func (o *searchRepoOptions) run(out io.Writer, args []string) error {
|
|
|
|
func (o *searchRepoOptions) run(out io.Writer, args []string) error {
|
|
|
|
o.setupSearchedVersion()
|
|
|
|
o.setupSearchedVersion()
|
|
|
|
|
|
|
|
|
|
|
|
index, err := o.buildIndex(out)
|
|
|
|
index, err := o.buildIndex()
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -171,7 +172,7 @@ func (o *searchRepoOptions) applyConstraint(res []*search.Result) ([]*search.Res
|
|
|
|
return data, nil
|
|
|
|
return data, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (o *searchRepoOptions) buildIndex(out io.Writer) (*search.Index, error) {
|
|
|
|
func (o *searchRepoOptions) buildIndex() (*search.Index, error) {
|
|
|
|
// Load the repositories.yaml
|
|
|
|
// Load the repositories.yaml
|
|
|
|
rf, err := repo.LoadFile(o.repoFile)
|
|
|
|
rf, err := repo.LoadFile(o.repoFile)
|
|
|
|
if isNotExist(err) || len(rf.Repositories) == 0 {
|
|
|
|
if isNotExist(err) || len(rf.Repositories) == 0 {
|
|
|
@ -184,8 +185,7 @@ func (o *searchRepoOptions) buildIndex(out io.Writer) (*search.Index, error) {
|
|
|
|
f := filepath.Join(o.repoCacheDir, helmpath.CacheIndexFile(n))
|
|
|
|
f := filepath.Join(o.repoCacheDir, helmpath.CacheIndexFile(n))
|
|
|
|
ind, err := repo.LoadIndexFile(f)
|
|
|
|
ind, err := repo.LoadIndexFile(f)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
// TODO should print to stderr
|
|
|
|
fmt.Fprintf(os.Stderr, "WARNING: Repo %q is corrupt or missing. Try 'helm repo update'.", n)
|
|
|
|
fmt.Fprintf(out, "WARNING: Repo %q is corrupt or missing. Try 'helm repo update'.", n)
|
|
|
|
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|