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 use the customization_scripts table for LXCA config patterns #16036

Merged
merged 3 commits into from
Oct 9, 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: 0 additions & 3 deletions app/models/configuration_template.rb

This file was deleted.

10 changes: 5 additions & 5 deletions app/models/ems_refresh/save_inventory_physical_infra.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def save_ems_physical_infra_inventory(ems, hashes, target = nil)

child_keys = [
:physical_servers,
:configuration_templates
:customization_scripts
]

# Save and link other subsections
Expand Down Expand Up @@ -52,18 +52,18 @@ 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)
def save_customization_scripts_inventory(ems, hashes, target = nil)
target = ems if target.nil?

ems.configuration_templates.reset
ems.customization_scripts.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)
save_inventory_multi(ems.customization_scripts, hashes, deletes, [:manager_ref])
store_ids_for_new_records(ems.customization_scripts, hashes, :manager_ref)
end

#
Expand Down
2 changes: 1 addition & 1 deletion app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +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_many :customization_scripts, :foreign_key => "manager_id", :dependent => :destroy, :inverse_of => :ext_management_system
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdunne Is it safe to leave this here? Or should it also be moved to the other PR since it uses the renamed "manager_id" field?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine.


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

Expand Down
20 changes: 10 additions & 10 deletions db/fixtures/miq_product_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6401,25 +6401,25 @@
:feature_type: view
:identifier: guest_device_show

# Configuration Templates
- :name: Configuration Templates
:description: Everything under Configuration Templates
# Customization Scripts
- :name: Customization Scripts
:description: Everything under Customization Scripts
:feature_type: node
:identifier: configuration_template
:identifier: customization_script
:children:
- :name: View
:description: View Configuration Template
:description: View Customization Script
:feature_type: view
:identifier: configuration_template_view
:identifier: customization_script_view
:children:
- :name: List
:description: Display Lists of Configuration Templates
:description: Display Lists of Customization Scripts
:feature_type: view
:identifier: configuration_template_show_list
:identifier: customization_script_show_list
- :name: Show
:description: Display Individual Configuration Templates
:description: Display Individual Customization Scripts
:feature_type: view
:identifier: configuration_template_show
:identifier: customization_script_show

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