From eb4971c85d376545c7035d973e81629b15ae9f84 Mon Sep 17 00:00:00 2001 From: Rene Scheepers Date: Wed, 27 Jul 2022 16:33:50 +0200 Subject: [PATCH] fix: return empty hash of events when request failed --- lib/krane/kubernetes_resource.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/krane/kubernetes_resource.rb b/lib/krane/kubernetes_resource.rb index 9d3e6081a..0de6faf42 100644 --- a/lib/krane/kubernetes_resource.rb +++ b/lib/krane/kubernetes_resource.rb @@ -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|