Skip to content
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

Generalize targeted inventory collection saving #15198

Merged

Conversation

Ladas
Copy link
Contributor

@Ladas Ladas commented May 23, 2017

Generalize targeted inventory collection saving

Ladas added 4 commits May 23, 2017 17:43
Generalize targeted saving using the InventoryCollection
Base IC configurations for a CloudManager targeted refresh
Base IC configurations for a CloudManager targeted refresh
Fix rubocop issue with map(&:foreign_key)
@Ladas
Copy link
Contributor Author

Ladas commented May 23, 2017

@miq-bot assign @agrare

@Ladas
Copy link
Contributor Author

Ladas commented May 23, 2017

@miq-bot add_label enhancement

Autofix rubocop issues
@@ -92,14 +93,22 @@ def hardwares(extra_attributes = {})
relation
end

attributes[:targeted_arel] = lambda do |inventory_collection|
manager_uuids = inventory_collection.parent_inventory_collections.collect(&:manager_uuids).map(&:to_a).flatten
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer .flat_map over .collect.map.flatten

manager_uuids = inventory_collection.parent_inventory_collections.flat_map { |c| c.manager_uuids.to_a }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Ladas added 2 commits May 24, 2017 12:56
Check for targeted? when scanning targeted dependencies
Use flat_map instead of collect&map&flattten
@miq-bot
Copy link
Member

miq-bot commented May 24, 2017

Checked commits Ladas/manageiq@b4bb3fb~...0d0f45d with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
4 files checked, 2 offenses detected

app/models/manager_refresh/inventory_collection.rb

app/models/manager_refresh/inventory_collection_default/cloud_manager.rb

@agrare agrare merged commit 53ddf88 into ManageIQ:master May 25, 2017
@agrare agrare added this to the Sprint 62 Ending Jun 5, 2017 milestone May 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants