-
Notifications
You must be signed in to change notification settings - Fork 897
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
Custom reconnect block #15605
Custom reconnect block #15605
Conversation
Add custom_reconnect_block to handle complex reconnect logic
Invoke custom_reconnect_block if defined as part of saving, allowing us to do reconnec instead of saving.
Test that reconnect logic works
13fd8e0
to
6f261c4
Compare
Fix rubocop issues
675af3f
to
f805115
Compare
Checked commits Ladas/manageiq@9b04398~...f805115 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@@ -67,6 +67,10 @@ def save!(inventory_collection, association) | |||
end | |||
end | |||
|
|||
unless inventory_collection.custom_reconnect_block.nil? | |||
inventory_collection.custom_reconnect_block.call(inventory_collection, inventory_objects_index, attributes_index) | |||
end |
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.
So for objects that are re-connected by this block, what prevents them from being created by the next section?
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.
for now we need to remove them from inventory_objects_index, the rest will get created.
I think once we implement this for hosts and vms, we can generalize this alghorithm
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 okay thanks
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.
I'm good with this for now but I think we should move towards the reconnect block just finding the records to reconnect then having the core save code just do a normal update.
Custom reconnect block allowing us to implement a complex reconnect logic of records.