mirror of
https://github.com/helm/helm.git
synced 2026-03-28 05:14:17 -04:00
Revert "fix(cmd/helm): user friendly error message when repos are not configured"
This reverts commit c4b76f27de.
This commit is contained in:
parent
c4b76f27de
commit
c19253d7cd
5 changed files with 15 additions and 14 deletions
|
|
@ -18,9 +18,7 @@ package main
|
|||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"helm.sh/helm/cmd/helm/require"
|
||||
|
|
@ -50,7 +48,3 @@ func newRepoCmd(out io.Writer) *cobra.Command {
|
|||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func isNotExist(err error) bool {
|
||||
return os.IsNotExist(errors.Cause(err))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@ func newRepoListCmd(out io.Writer) *cobra.Command {
|
|||
Args: require.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
f, err := repo.LoadFile(settings.RepositoryConfig)
|
||||
if isNotExist(err) || len(f.Repositories) == 0 {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(f.Repositories) == 0 {
|
||||
return errors.New("no repositories to show")
|
||||
}
|
||||
table := uitable.New()
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ func newRepoRemoveCmd(out io.Writer) *cobra.Command {
|
|||
|
||||
func (o *repoRemoveOptions) run(out io.Writer) error {
|
||||
r, err := repo.LoadFile(o.repoFile)
|
||||
if isNotExist(err) || len(r.Repositories) == 0 {
|
||||
return errors.New("no repositories configured")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !r.Remove(o.name) {
|
||||
|
|
|
|||
|
|
@ -59,9 +59,13 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command {
|
|||
}
|
||||
|
||||
func (o *repoUpdateOptions) run(out io.Writer) error {
|
||||
f, err := repo.LoadFile(settings.RepositoryConfig)
|
||||
if isNotExist(err) || len(f.Repositories) == 0 {
|
||||
return errors.New("no repositories to update")
|
||||
f, err := repo.LoadFile(o.repoFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(f.Repositories) == 0 {
|
||||
return errNoRepositories
|
||||
}
|
||||
var repos []*repo.ChartRepository
|
||||
for _, cfg := range f.Repositories {
|
||||
|
|
|
|||
|
|
@ -147,8 +147,8 @@ func (o *searchRepoOptions) formatSearchResults(res []*search.Result) string {
|
|||
func (o *searchRepoOptions) buildIndex(out io.Writer) (*search.Index, error) {
|
||||
// Load the repositories.yaml
|
||||
rf, err := repo.LoadFile(o.repoFile)
|
||||
if isNotExist(err) || len(rf.Repositories) == 0 {
|
||||
return nil, errors.New("no repositories configured")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "loading repository config")
|
||||
}
|
||||
|
||||
i := search.NewIndex()
|
||||
|
|
|
|||
Loading…
Reference in a new issue