From de4bc2977f46f302102135beaa79604a98e25b0e Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Thu, 18 Jul 2019 12:47:22 -0400 Subject: [PATCH] Only call capture_infra_targets on InfraManagers Fix an bug where metrics capture on a NetworkProvider blows up if it doesn't have a parent manager (e.g. Nuage). NetworkManagers delegate hosts to the parent cloud_manager and capture_infra_targets calls ems.hosts. --- app/models/metric/targets.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/metric/targets.rb b/app/models/metric/targets.rb index c7bb9bf766a..fb3c5c72ed7 100644 --- a/app/models/metric/targets.rb +++ b/app/models/metric/targets.rb @@ -141,7 +141,7 @@ def self.capture_vm_targets(emses, hosts) def self.capture_targets(zone = nil, options = {}) zone = MiqServer.my_server.zone if zone.nil? zone = Zone.find(zone) if zone.kind_of?(Integer) - capture_infra_targets(zone.ext_management_systems, options) + \ + capture_infra_targets(zone.ems_infras, options) + \ capture_cloud_targets(zone.ems_clouds, options) + \ capture_container_targets(zone.ems_containers, options) end