Skip to content

fix: Fix error messages returned by HelmChartGetter #598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/handlers/generic/lifecycle/config/cm.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ func (h *HelmChartGetter) For(
name Component,
) (*HelmChart, error) {
log.Info(
fmt.Sprintf("Fetching HelmChart info for %s from configmap %s/%s",
fmt.Sprintf("Fetching HelmChart info for %q from configmap %s/%s",
string(name),
h.cmName,
h.cmNamespace),
h.cmNamespace,
h.cmName),
Comment on lines +79 to +82
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nitty but interesting all the same imo: I'm starting to prefer creating client.ObjectKey and relying on the stringifying of that rather than relying on ordering like this - I've seen it mixed up so many times. Also no need to cast name to a string.

Suggested change
fmt.Sprintf("Fetching HelmChart info for %q from configmap %s/%s",
string(name),
h.cmName,
h.cmNamespace),
h.cmNamespace,
h.cmName),
fmt.Sprintf(
"Fetching HelmChart info for %q from configmap %s",
name,
client.ObectKey{Namespace: h.cmNamespace, h.cmName},
),

)
cm, err := h.get(ctx)
if err != nil {
return nil, err
}
d, ok := cm.Data[string(name)]
if !ok {
return nil, fmt.Errorf("did not find key %s in %v", name, cm.Data)
return nil, fmt.Errorf("did not find key %q in configmap %s/%s", name, h.cmNamespace, h.cmName)
}
var settings HelmChart
err = yaml.Unmarshal([]byte(d), &settings)
Expand Down
Loading