From 72072585853c19903f3faff20e9f44f6b17b8989 Mon Sep 17 00:00:00 2001 From: James Wong Date: Wed, 10 Jan 2018 16:23:35 -0500 Subject: [PATCH 1/2] fix association between EMS and ConfigurationSystem --- app/models/ext_management_system.rb | 1 + app/models/manageiq/providers/automation_manager.rb | 1 - app/models/manageiq/providers/configuration_manager.rb | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index a3e1b9ffd34..7e901759ecd 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -29,6 +29,7 @@ def self.supported_types_and_descriptions_hash belongs_to :provider has_many :child_managers, :class_name => 'ExtManagementSystem', :foreign_key => 'parent_ems_id' + has_many :configured_systems, :dependent => :destroy, :foreign_key => "manager_id" belongs_to :tenant has_many :container_deployments, :foreign_key => :deployed_on_ems_id, :inverse_of => :deployed_on_ems diff --git a/app/models/manageiq/providers/automation_manager.rb b/app/models/manageiq/providers/automation_manager.rb index 5ff9019c44a..c876a86422b 100644 --- a/app/models/manageiq/providers/automation_manager.rb +++ b/app/models/manageiq/providers/automation_manager.rb @@ -8,7 +8,6 @@ class ManageIQ::Providers::AutomationManager < ManageIQ::Providers::BaseManager require_nested :InventoryRootGroup require_nested :OrchestrationStack - has_many :configured_systems, :dependent => :destroy, :foreign_key => "manager_id" has_many :configuration_profiles, :dependent => :destroy, :foreign_key => "manager_id" has_many :configuration_scripts, :dependent => :destroy, :foreign_key => "manager_id" has_many :credentials, :class_name => "ManageIQ::Providers::AutomationManager::Authentication", diff --git a/app/models/manageiq/providers/configuration_manager.rb b/app/models/manageiq/providers/configuration_manager.rb index 4151d91af9d..83012ea4cde 100644 --- a/app/models/manageiq/providers/configuration_manager.rb +++ b/app/models/manageiq/providers/configuration_manager.rb @@ -1,5 +1,4 @@ class ManageIQ::Providers::ConfigurationManager < ManageIQ::Providers::BaseManager - has_many :configured_systems, :dependent => :destroy, :foreign_key => "manager_id" has_many :configuration_profiles, :dependent => :destroy, :foreign_key => "manager_id" has_many :configuration_scripts, :dependent => :destroy, :foreign_key => "manager_id" has_many :configuration_script_sources, :dependent => :destroy, :foreign_key => "manager_id" From 832f547fc564e876bcfdd89653c5b2c94311ad05 Mon Sep 17 00:00:00 2001 From: James Wong Date: Wed, 10 Jan 2018 21:58:28 -0500 Subject: [PATCH 2/2] moving other configuration_* up --- app/models/ext_management_system.rb | 4 ++++ app/models/manageiq/providers/automation_manager.rb | 4 ---- app/models/manageiq/providers/configuration_manager.rb | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/models/ext_management_system.rb b/app/models/ext_management_system.rb index 7e901759ecd..7698f2cbb1b 100644 --- a/app/models/ext_management_system.rb +++ b/app/models/ext_management_system.rb @@ -30,6 +30,10 @@ def self.supported_types_and_descriptions_hash belongs_to :provider has_many :child_managers, :class_name => 'ExtManagementSystem', :foreign_key => 'parent_ems_id' has_many :configured_systems, :dependent => :destroy, :foreign_key => "manager_id" + has_many :configuration_profiles, :dependent => :destroy, :foreign_key => "manager_id" + has_many :configuration_scripts, :dependent => :destroy, :foreign_key => "manager_id" + has_many :configuration_script_sources, :dependent => :destroy, :foreign_key => "manager_id" + has_many :configuration_script_payloads, :through => :configuration_script_sources belongs_to :tenant has_many :container_deployments, :foreign_key => :deployed_on_ems_id, :inverse_of => :deployed_on_ems diff --git a/app/models/manageiq/providers/automation_manager.rb b/app/models/manageiq/providers/automation_manager.rb index c876a86422b..8b7b2df7491 100644 --- a/app/models/manageiq/providers/automation_manager.rb +++ b/app/models/manageiq/providers/automation_manager.rb @@ -8,14 +8,10 @@ class ManageIQ::Providers::AutomationManager < ManageIQ::Providers::BaseManager require_nested :InventoryRootGroup require_nested :OrchestrationStack - has_many :configuration_profiles, :dependent => :destroy, :foreign_key => "manager_id" - has_many :configuration_scripts, :dependent => :destroy, :foreign_key => "manager_id" has_many :credentials, :class_name => "ManageIQ::Providers::AutomationManager::Authentication", :as => :resource, :dependent => :destroy has_many :inventory_groups, :dependent => :destroy, :foreign_key => "ems_id", :inverse_of => :manager has_many :inventory_root_groups, :dependent => :destroy, :foreign_key => "ems_id", :inverse_of => :manager - has_many :configuration_script_sources, :dependent => :destroy, :foreign_key => "manager_id" - has_many :configuration_script_payloads, :through => :configuration_script_sources delegate :url, :to => :provider diff --git a/app/models/manageiq/providers/configuration_manager.rb b/app/models/manageiq/providers/configuration_manager.rb index 83012ea4cde..c789acca2a6 100644 --- a/app/models/manageiq/providers/configuration_manager.rb +++ b/app/models/manageiq/providers/configuration_manager.rb @@ -1,7 +1,4 @@ class ManageIQ::Providers::ConfigurationManager < ManageIQ::Providers::BaseManager - has_many :configuration_profiles, :dependent => :destroy, :foreign_key => "manager_id" - has_many :configuration_scripts, :dependent => :destroy, :foreign_key => "manager_id" - has_many :configuration_script_sources, :dependent => :destroy, :foreign_key => "manager_id" delegate :url, :to => :provider