Skip to content

Commit

Permalink
fix: return empty hash of events when request failed
Browse files Browse the repository at this point in the history
  • Loading branch information
renescheepers committed Jul 27, 2022
1 parent cbb116a commit eb4971c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/krane/kubernetes_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,7 @@ def fetch_events(kubectl)

out, err, st = kubectl.run("get", "events", "--output=go-template=#{Event.go_template_for(group, kind, name)}",
log_failure: false, use_namespace: !global?)

raise FatalKubeAPIError, "Error retrieving events: #{err}" unless st.success?
return {} unless st.success?

event_collector = Hash.new { |hash, key| hash[key] = [] }
Event.extract_all_from_go_template_blob(out).each_with_object(event_collector) do |candidate, events|
Expand Down

0 comments on commit eb4971c

Please sign in to comment.