From 08bd58f196a38d6f0daa3c18e41a5f42d0fb4f57 Mon Sep 17 00:00:00 2001 From: Mooli Tayer Date: Tue, 25 Jul 2017 18:39:10 +0300 Subject: [PATCH] Allow nil parent for tests --- .../providers/kubernetes/monitoring_manager_mixin.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/manageiq/providers/kubernetes/monitoring_manager_mixin.rb b/app/models/manageiq/providers/kubernetes/monitoring_manager_mixin.rb index 09efbe0008..46b83fbdac 100644 --- a/app/models/manageiq/providers/kubernetes/monitoring_manager_mixin.rb +++ b/app/models/manageiq/providers/kubernetes/monitoring_manager_mixin.rb @@ -5,7 +5,8 @@ module ManageIQ::Providers::Kubernetes::MonitoringManagerMixin included do delegate :authentications, :endpoints, - :to => :parent_manager + :to => :parent_manager, + :allow_nil => true default_value_for :port do |manager| manager.port || DEFAULT_PORT @@ -19,7 +20,7 @@ def raw_connect(hostname, port, options) end def default_endpoint - endpoints.detect { |x| x.role == ENDPOINT_ROLE.to_s } + endpoints && endpoints.detect { |x| x.role == ENDPOINT_ROLE.to_s } end def supports_port?