From 48f03d316b81b2f9d2d10e2e411c93930d349ff5 Mon Sep 17 00:00:00 2001 From: Robert Sirchia Date: Wed, 26 Feb 2025 15:21:47 -0500 Subject: [PATCH 1/3] changing from log to slog Signed-off-by: Robert Sirchia --- pkg/repo/index.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/repo/index.go b/pkg/repo/index.go index c5f808229..3e063becf 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -19,7 +19,7 @@ package repo import ( "bytes" "encoding/json" - "log" + "log/slog" "os" "path" "path/filepath" @@ -154,7 +154,7 @@ func (i IndexFile) MustAdd(md *chart.Metadata, filename, baseURL, digest string) // Deprecated: Use index.MustAdd instead. func (i IndexFile) Add(md *chart.Metadata, filename, baseURL, digest string) { if err := i.MustAdd(md, filename, baseURL, digest); err != nil { - log.Printf("skipping loading invalid entry for chart %q %q from %s: %s", md.Name, md.Version, filename, err) + slog.Error("skipping loading invalid entry for chart %q %q from %s: %s", md.Name, md.Version, filename, err) } } @@ -356,7 +356,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) { for name, cvs := range i.Entries { for idx := len(cvs) - 1; idx >= 0; idx-- { if cvs[idx] == nil { - log.Printf("skipping loading invalid entry for chart %q from %s: empty entry", name, source) + slog.Info("skipping loading invalid entry for chart %q from %s: empty entry", name, source) continue } // When metadata section missing, initialize with no data @@ -367,7 +367,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) { cvs[idx].APIVersion = chart.APIVersionV1 } if err := cvs[idx].Validate(); ignoreSkippableChartValidationError(err) != nil { - log.Printf("skipping loading invalid entry for chart %q %q from %s: %s", name, cvs[idx].Version, source, err) + slog.Error("skipping loading invalid entry for chart %q %q from %s: %s", name, cvs[idx].Version, source, err) cvs = append(cvs[:idx], cvs[idx+1:]...) } } From a11f4c00265bdef681d2a84d3c7dfa4bb81d4812 Mon Sep 17 00:00:00 2001 From: Robert Sirchia Date: Thu, 27 Feb 2025 12:56:52 -0500 Subject: [PATCH 2/3] changing info to error Signed-off-by: Robert Sirchia --- pkg/repo/index.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 3e063becf..954d7486c 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -356,7 +356,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) { for name, cvs := range i.Entries { for idx := len(cvs) - 1; idx >= 0; idx-- { if cvs[idx] == nil { - slog.Info("skipping loading invalid entry for chart %q from %s: empty entry", name, source) + slog.Error("skipping loading invalid entry for chart %q from %s: empty entry", name, source) continue } // When metadata section missing, initialize with no data From f50547bf51aab27966b332fa10d80ac62873b85c Mon Sep 17 00:00:00 2001 From: Robert Sirchia Date: Fri, 28 Feb 2025 15:22:47 -0500 Subject: [PATCH 3/3] changing error to warn as requested by Matt Signed-off-by: Robert Sirchia --- pkg/repo/index.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/repo/index.go b/pkg/repo/index.go index 954d7486c..4f0266ca6 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -356,7 +356,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) { for name, cvs := range i.Entries { for idx := len(cvs) - 1; idx >= 0; idx-- { if cvs[idx] == nil { - slog.Error("skipping loading invalid entry for chart %q from %s: empty entry", name, source) + slog.Warn("skipping loading invalid entry for chart %q from %s: empty entry", name, source) continue } // When metadata section missing, initialize with no data @@ -367,7 +367,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) { cvs[idx].APIVersion = chart.APIVersionV1 } if err := cvs[idx].Validate(); ignoreSkippableChartValidationError(err) != nil { - slog.Error("skipping loading invalid entry for chart %q %q from %s: %s", name, cvs[idx].Version, source, err) + slog.Warn("skipping loading invalid entry for chart %q %q from %s: %s", name, cvs[idx].Version, source, err) cvs = append(cvs[:idx], cvs[idx+1:]...) } }