-
Notifications
You must be signed in to change notification settings - Fork 23
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] Add an option to store record changes #115
base: master
Are you sure you want to change the base?
Conversation
161e73f
to
d454709
Compare
ca1ad00
to
5ee3f32
Compare
5ee3f32
to
21b565d
Compare
NOTE this doesn't work on ruby 2.5 and was causing CI failures. Separately I'd like to drop 2.5 from the supported ruby versions but don't want to do that all in one PR |
# @param track_record_changes [Boolean/Array] By default false. If false no changes to the InventoryObject will be stored, | ||
# otherwise changes to properties enumerated in the array will be stored for use by other inventory collections | ||
# Example: :track_record_changes => [:name, :raw_power_state] |
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.
NOTE: I went back and forth a lot on a separate attribute to track the filter plus a boolean to turn on/off, versus combining them all in one attribute. On one hand it is handy to only need one attribute (we have a lot of knobs here already) on the other hand could be confusing to have a boolean/array datatype.
@@ -214,6 +215,11 @@ def store_deleted_records(records) | |||
@deleted_records.concat(records_identities(records)) | |||
end | |||
|
|||
def store_record_changes(records) | |||
records = [records] unless records.respond_to?(:map) | |||
@record_changes.merge!(records.map { |r| [record_identity(r)[:id], r.changes.slice(*track_record_changes)] }.to_h) |
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.
@record_changes.merge!(records.map { |r| [record_identity(r)[:id], r.changes.slice(*track_record_changes)] }.to_h) | |
records.each_with_object(@record_changes) { |r, h| h[record_identity(r)[:id]] = , r.changes.slice(*track_record_changes) } |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
This pull request has been automatically closed because it has not been updated for at least 3 months. Feel free to reopen this pull request if these changes are still valid. Thank you for all your contributions! More information about the ManageIQ triage process can be found in the triage process documentation. |
@agrare Thought this was almost ready (already ready?). Do we want to reopen? |
I ran into issues with concurrent_safe batch and wasn't able to make progress |
Checked commits agrare/inventory_refresh@d454709~...87ab409 with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint lib/inventory_refresh/inventory_collection.rb
|
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
3 similar comments
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
This pull request has been automatically marked as stale because it has not been updated for at least 3 months. If these changes are still valid, please remove the |
Add the option to store changes to records that occurred during refresh.
TODO: