From d7912967b367bb5732e12af6bfc5e78074d461b5 Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Fri, 20 Jul 2018 15:15:11 +0200 Subject: [PATCH] Replace custom_attributes by ems_custom_attributes Replace custom_attributes by ems_custom_attributes, which is correctly scoped --- app/models/manageiq/providers/infra_manager.rb | 1 + .../inventory_collection/builder/infra_manager.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/manageiq/providers/infra_manager.rb b/app/models/manageiq/providers/infra_manager.rb index 22b608a062b..9e0a9a8e87a 100644 --- a/app/models/manageiq/providers/infra_manager.rb +++ b/app/models/manageiq/providers/infra_manager.rb @@ -18,6 +18,7 @@ class InfraManager < BaseManager has_many :subnets, -> { distinct }, :through => :lans has_many :networks, :through => :hardwares has_many :guest_devices, :through => :hardwares + has_many :ems_custom_attributes, :through => :vms_and_templates class << model_name define_method(:route_key) { "ems_infras" } diff --git a/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb b/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb index 0b5896001f8..9b599324c5e 100644 --- a/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb +++ b/app/models/manager_refresh/inventory_collection/builder/infra_manager.rb @@ -54,8 +54,9 @@ def host_operating_systems ) end - def custom_attributes + def ems_custom_attributes add_properties( + :model_class => ::CustomAttribute, :manager_ref => %i(name), :parent_inventory_collections => %i(vms miq_templates), )