Skip to content

Commit

Permalink
Merge pull request #15956 from skovic/config-patterns
Browse files Browse the repository at this point in the history
Update model to support LXCA config patterns
  • Loading branch information
blomquisg authored Sep 18, 2017
2 parents c1549f0 + 477874c commit a160544
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
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 @@ -6391,6 +6391,26 @@
:feature_type: view
:identifier: guest_device_show

# Configuration Templates
- :name: Configuration Templates
:description: Everything under Configuration Templates
:feature_type: node
:identifier: configuration_template
:children:
- :name: View
:description: View Configuration Template
:feature_type: view
:identifier: configuration_template_view
:children:
- :name: List
:description: Display Lists of Configuration Templates
:feature_type: view
:identifier: configuration_template_show_list
- :name: Show
:description: Display Individual Configuration Templates
:feature_type: view
:identifier: configuration_template_show

# Physical Infrastructure Topology
- :name: Physical Infra Topology
:description: Physical Infra Topology
Expand Down

0 comments on commit a160544

Please sign in to comment.