-
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
Proper parent initialization #14209
Proper parent initialization #14209
Conversation
Set manager only if not sent in options
Explicitly pass :parent => nil, because it has a priority over :arel in the DB strategies.
Checked commits Ladas/manageiq@ff28bce~...9265a8b with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
could you try to update the description to be more explanatory?
|
The priorities are here manageiq/app/models/manager_refresh/inventory_collection.rb Lines 426 to 441 in 6d90d8d
|
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.
ok. I think what confuses / annoys me, is that we have to pass something as nil
Maybe defaulting the :parent
to manager
is not so good...
👍 until we see a lot of :parent => nil
Are there any specs around cross-linking? Seems this should have caused a test failure with good test coverage |
looks to handle the use case well. thanks ladas |
Set :parent to manager only if not sent in options and explicitly pass :parent => nil, because it has a priority over :arel in the DB strategies.
So e.g. for AWS, when we use a DB strategy, it's enough to use parent and association, since the related Vm can only be in the scope of manager.vms. But for Ansible, the crosslink can be to any VM, therefore we use a generic arel to get to the right Vm.
The priority for DB strategy starting with higher priority is: :custom_db_finder, :parent & :association, :arel. So the first defined is used for fetching data from the DB.