-
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
InventoryCollection Builder improvements #17621
InventoryCollection Builder improvements #17621
Conversation
cc @agrare |
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
4f286cb
to
1aac036
Compare
Kubernetes support
1aac036
to
5e18027
Compare
Cc @Ladas |
@@ -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 |
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.
nit: I think the YARD syntax is [Symbol, Array]
value | ||
end | ||
# Evaluates lambda blocks in @default_values and @dependency_attributes | ||
# @param values[Hash] |
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.
nit: missing space values [Hash]
end | ||
end | ||
end | ||
@options[:auto_inventory_attributes] = false |
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 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) |
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.
@agrare I wonder what you've meant by this :-)
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.
Ha I'm pretty sure I didn't write this, let me track down where it came from
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.
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
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.
@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 |
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.
❤️
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.
Few nits, otherwise looks awesome.
ef78119
to
d9ed848
Compare
For auto_inventory_attributes and without_model_class
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 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) |
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.
👍 this seems much nicer than evaluate_builder_params_lambdas!
@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? |
@agrare I added an alias to All providers tested locally without problems |
@slemrmartin ah you're right I totally missed that alias, 👍 |
Issue: #17396
Renaming builder_params => default_values (partially)
Merged common definitions from provider specific