Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update model to support LXCA config patterns #15956

Merged
merged 3 commits into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/models/configuration_template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ConfigurationTemplate < ApplicationRecord
belongs_to :ext_management_system, :foreign_key => "ems_id"
end
15 changes: 15 additions & 0 deletions app/models/ems_refresh/save_inventory_physical_infra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def save_ems_physical_infra_inventory(ems, hashes, target = nil)

child_keys = [
:physical_servers,
:configuration_templates
]

# Save and link other subsections
Expand Down Expand Up @@ -51,6 +52,20 @@ def save_physical_servers_inventory(ems, hashes, target = nil)
store_ids_for_new_records(ems.physical_servers, hashes, :ems_ref)
end

def save_configuration_templates_inventory(ems, hashes, target = nil)
target = ems if target.nil?

ems.configuration_templates.reset
deletes = if target == ems
:use_association
else
[]
end

save_inventory_multi(ems.configuration_templates, hashes, deletes, [:ems_ref])
store_ids_for_new_records(ems.configuration_templates, hashes, :ems_ref)
end

#
# Saves asset details information of a resource
#
Expand Down
1 change: 1 addition & 0 deletions app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ def self.supported_types_and_descriptions_hash
has_many :customization_specs, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :storage_profiles, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :physical_servers, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system
has_many :configuration_templates, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system

has_one :iso_datastore, :foreign_key => "ems_id", :dependent => :destroy, :inverse_of => :ext_management_system

Expand Down
20 changes: 20 additions & 0 deletions db/fixtures/miq_product_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6375,6 +6375,26 @@
:feature_type: view