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

InventoryCollection Builder improvements #17621

Merged
merged 12 commits into from
Jul 11, 2018

Conversation

@slemrmartin
Copy link
Contributor Author

cc @agrare

@miq-bot miq-bot removed the wip label Jun 25, 2018
@slemrmartin slemrmartin changed the title InventoryCollection Builder improvements [WIP] InventoryCollection Builder improvements Jun 25, 2018
@miq-bot miq-bot added the wip label Jun 25, 2018
Renaming builder_params => default_values (partially)
Merged common definitions from provider specific
Derives attributes correctly if you specify model_class as param of add_collection()
Added support for PhysicalInfra - Redfish
@slemrmartin slemrmartin force-pushed the ic-builder-optimalization branch from 1aac036 to 5e18027 Compare July 2, 2018 13:21
@slemrmartin slemrmartin changed the title [WIP] InventoryCollection Builder improvements InventoryCollection Builder improvements Jul 2, 2018
@slemrmartin
Copy link
Contributor Author

Cc @Ladas

@miq-bot miq-bot removed the wip label Jul 2, 2018
@slemrmartin slemrmartin changed the title InventoryCollection Builder improvements [WIP] InventoryCollection Builder improvements Jul 2, 2018
@miq-bot miq-bot added the wip label Jul 2, 2018
@slemrmartin slemrmartin changed the title [WIP] InventoryCollection Builder improvements InventoryCollection Builder improvements Jul 3, 2018
@slemrmartin slemrmartin mentioned this pull request Jul 3, 2018
1 task
@miq-bot miq-bot removed the wip label Jul 3, 2018
@@ -28,7 +29,7 @@ def self.default_options

# Entry point
# Creates builder and builds data for inventory collection
# @param name [Symbol] InventoryCollection.association value
# @param name [Symbol || Array] InventoryCollection.association value. <name> method not called when Array
Copy link
Contributor

@Ladas Ladas Jul 4, 2018

Choose a reason for hiding this comment

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

nit: I think the YARD syntax is [Symbol, Array]

value
end
# Evaluates lambda blocks in @default_values and @dependency_attributes
# @param values[Hash]
Copy link
Contributor

@Ladas Ladas Jul 4, 2018

Choose a reason for hiding this comment

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

nit: missing space values [Hash]

end
end
end
@options[:auto_inventory_attributes] = false
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not much of fan of instance variable interface, could we have some setter that would set the options just for this 1 InventoryCollection? Otherwise there can be hard to find side effects

class InventoryCollection
class Builder
class ContainerManager < ::ManagerRefresh::InventoryCollection::Builder
# TODO: (agrare) Targeted refreshes will require adjusting the associations / arels. (duh)
Copy link
Contributor

Choose a reason for hiding this comment

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

@agrare I wonder what you've meant by this :-)

Copy link
Member

Choose a reason for hiding this comment

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

Ha I'm pretty sure I didn't write this, let me track down where it came from

Copy link
Member

Choose a reason for hiding this comment

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

Looks like it was @cben, I took his changes from #14337 and applied to the new repo after it was split out here ManageIQ/manageiq-providers-kubernetes#30

Link to the original comment: https://github.com/ManageIQ/manageiq/pull/14337/files#diff-65533e4742c2672e65b884331a5ad673R43

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@agrare sorry I looked only to annotation, I'll change it

@@ -19,7 +19,7 @@ module ManagerRefresh::InventoryCollection::Builder::PersisterHelper
# )
# )
#
# @see ManagerRefresh::InventoryCollection::Builder
# @see documentation https://github.com/ManageIQ/guides/tree/master/providers/persister/inventory_collections.md
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

@Ladas Ladas left a comment

Choose a reason for hiding this comment

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

Few nits, otherwise looks awesome.

@slemrmartin slemrmartin force-pushed the ic-builder-optimalization branch from ef78119 to d9ed848 Compare July 4, 2018 12:12
For auto_inventory_attributes and without_model_class
@miq-bot
Copy link
Member

miq-bot commented Jul 4, 2018

Checked commits slemrmartin/manageiq@813af66~...f46fb65 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
10 files checked, 1 offense detected

app/models/manager_refresh/inventory_collection/builder/cloud_manager.rb


# Evaluates lambda blocks
def evaluate_lambdas!(persister)
evaluate_builder_params_lambdas!(persister)
@default_values = evaluate_lambdas_on(@default_values, persister)
@dependency_attributes = evaluate_lambdas_on(@dependency_attributes, persister)
Copy link
Member

Choose a reason for hiding this comment

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

👍 this seems much nicer than evaluate_builder_params_lambdas!

@agrare
Copy link
Member

agrare commented Jul 10, 2018

@slemrmartin this looks good to me, I assume we'll need to merge this and the rest of the provider PRs together since at least the builder_params change is breaking?

Can you run the refresher specs for all of the providers locally before I merge this to make sure we don't run into any surprises when we kick the rest of the PRs?

@slemrmartin
Copy link
Contributor Author

@agrare I added an alias to add_builder_params so providers specs will work before and after merge of providers PRs.
:builder_params symbol will be refactored later, it influences more than builder and definitions.

All providers tested locally without problems

@agrare
Copy link
Member

agrare commented Jul 11, 2018

@slemrmartin ah you're right I totally missed that alias, 👍

@agrare agrare merged commit 9036816 into ManageIQ:master Jul 11, 2018
@agrare agrare added this to the Sprint 90 Ending Jul 16, 2018 milestone Jul 11, 2018
@slemrmartin slemrmartin deleted the ic-builder-optimalization branch July 26, 2018 08:15
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