-
Notifications
You must be signed in to change notification settings - Fork 900
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ class CustomizationScript < ApplicationRecord | |
|
||
acts_as_miq_taggable | ||
belongs_to :provisioning_manager | ||
belongs_to :ext_management_system, :foreign_key => "manager_id" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this (and the corresponding migration) be split into separate PRs? They're not really related to the rest of the changes here. Also, would you mind deprecating the old deprecate_belongs_to(:provisioning_manager, :ext_management_system) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bdunne I tested this change, and it looks like the deprecate is causing a problem. I am getting the following error in the UI: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh you'll also need to |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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(ems, hashes, target = nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method should have |
||
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 | ||
|
||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this line will have to be removed with the next line added. It might break some tests that have to be cleaned up. But, the
provisioning_manager
and theext_mangement_system
are actually really the same thing (both pointing toext_management_systems
table).