From 94779dc99f266adde81882412ee944072da3b136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Teo=20Klestrup=20R=C3=B6ijezon?= Date: Tue, 4 Jan 2022 14:24:55 +0100 Subject: [PATCH] fix(helm): ignore file-not-found error for `helm repo list -o json` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, `helm repo list -o json` returns (either `[]` or an english "no repositories" error message, depending on whether `$HELM_CONFIG_HOME/repositories.yaml` exists). This PR aligns the two cases so that it always returns `[]`. Signed-off-by: Teo Klestrup Röijezon --- cmd/helm/repo_list.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/repo_list.go b/cmd/helm/repo_list.go index efaf74155..c9b952fee 100644 --- a/cmd/helm/repo_list.go +++ b/cmd/helm/repo_list.go @@ -38,8 +38,8 @@ func newRepoListCmd(out io.Writer) *cobra.Command { Args: require.NoArgs, ValidArgsFunction: noCompletions, RunE: func(cmd *cobra.Command, args []string) error { - f, err := repo.LoadFile(settings.RepositoryConfig) - if isNotExist(err) || (len(f.Repositories) == 0 && !(outfmt == output.JSON || outfmt == output.YAML)) { + f, _ := repo.LoadFile(settings.RepositoryConfig) + if len(f.Repositories) == 0 && !(outfmt == output.JSON || outfmt == output.YAML) { return errors.New("no repositories to show") }