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
[WIP] Unifying the entity saving functions in save_inventory_container.rb. #6191
Conversation
@dkorn @moolitayer please review. Thanks! @miq-bot add_label providers/containers, refactoring |
@dkorn @moolitayer it would have been great if we had tests for Do we have a spec test elsewhere that may be relevant? Any suggestion for @yaacov to add testing for that? Thanks. |
@yaacov I think there should be a way to get |
@simon3z the function save_child_inventory call "save_#{k}inventory" using the key, we do not have to write all possible "save#{k}_inventory" functions ? |
So can't you just change IIRC there's a catch there (cc @dkorn), it can't be that easy. |
@simon3z suggested removing :node_selector_parts |
save_node_selector_parts_inventory is romved. |
has_many :selector_parts, -> { where(:section => "selectors") }, :class_name => CustomAttribute, | ||
:as => :resource, :dependent => :destroy | ||
has_many :container_conditions, :class_name => ContainerCondition, | ||
:as => :container_entity, :dependent => :destroy |
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.
@yaacov is this just different indentation? Please don't mix these changes because it's hard to understand what you're changing here.
@yaacov please squash all the patches... the PR should have just 1 patch. |
eff7663
to
3dfccc7
Compare
@simon3z I do not know the "real-world" meaning of node_selector vs. selector. The rspec passes, but do this changes have ok "real-world" meaning ? |
Please note I'm working on a big overhaul in save_inventory_container in preparation for the disconnect feature. I will post a link once it is ready. |
@moolitayer Thanks for the heads up :-) |
<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush. |
@simon3z this PR is outdated by @moolitayer s work, do we need it ? |
@@ -11,7 +11,7 @@ class ContainerGroup < ActiveRecord::Base | |||
has_many :container_definitions, :dependent => :destroy | |||
belongs_to :ext_management_system, :foreign_key => "ems_id" | |||
has_many :labels, -> { where(:section => "labels") }, :class_name => CustomAttribute, :as => :resource, :dependent => :destroy | |||
has_many :node_selector_parts, -> { where(:section => "node_selectors") }, :class_name => "CustomAttribute", :as => :resource, :dependent => :destroy | |||
has_many :selector_parts, -> { where(:section => "selectors") }, :class_name => CustomAttribute, :as => :resource, :dependent => :destroy |
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.
@yaacov @moolitayer @dkorn don't we need a migration script here? What about the current installations?
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.
@simon3z Current installations having containerGroups with selector_parts section => "node_selectors" will have to migrate to section => "selectors", does this make sense ? what is a node_selector and what is a selector ?
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.
@simon3z Added a migration file, need a review because I do not know how to test this :-(
4a38542
to
c878596
Compare
791b504
to
4d4bd03
Compare
…ts_inventory. By changing node_selector... symbols to selector... symbols.
Checked commit yaacov@40085c6 with ruby 2.2.3, rubocop 0.34.2, and haml-lint 0.13.0 app/models/container_group.rb
|
Closing PR because
|
Try to unify save_selector_parts_inventory and
save_node_selector_parts_inventory in
app/models/ems_refresh/save_inventory_container.rb.