-
Notifications
You must be signed in to change notification settings - Fork 107
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] Using the new tag mapping for graph refresh #384
Conversation
I'm currently getting this error.
from
|
Line 50 is notorious as a front, hiding all the shady business going on in refresh :-) 🚪 🎰 I'll also run this now. |
:section => section, | ||
:name => tag["key"], | ||
:value => tag["value"], | ||
:source => source |
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.
If you only use this function to feed map_labels, you only need :name and :value.
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.
Ok thanks!
Ok so it's showing the error as
|
In case it helps, this is the data I'm passing to parent:
tags_inventory_objects:
|
def map_taggings(parent, tags_inventory_objects) | ||
model_name = parent.inventory_collection.model_class.base_class.name | ||
key = [:taggings_for, model_name] | ||
collection = @inv_collections[key] |
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 are no @inv_collections[key]
first, you need to add the inv collection as @cben is doing it https://github.com/ManageIQ/manageiq-providers-kubernetes/pull/162/files#diff-26f0b75803f05ef203ec5099294834dfR380
then the collection will be here as in @collections
then call it e.g. as persister.taggings_for_vm
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.
the inventory collections should be added here https://github.com/Ladas/manageiq-providers-amazon/blob/f9123d84236a66348c4bd05d499c74f94f6d7594/app/models/manageiq/providers/amazon/inventory/persister/cloud_manager.rb#L26
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.
btw. NoMethodError: undefined method `[]' for nil:NilClass
is because @inv_collections are nil
We have @collections here, but we should not access it directly, that is why we call it as persister.collection_name
But unless you place it on @collections[collection.name] = InventoryCollection.new..., it will not be there
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 think the taggings collections can be added in app/models/manageiq/providers/amazon/inventory_collection_default/cloud_manager.rb similar to vm_and_template_labels
(and called from https://github.com/Ladas/manageiq-providers-amazon/blob/f9123d84236a66348c4bd05d499c74f94f6d7594/app/models/manageiq/providers/amazon/inventory/persister/cloud_manager.rb#L5)
playing with that now...
Also need to add persistor.add_inventory_collection(@tag_mapper.tags_to_resolve_collection)
somewhere.
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.
@cben yes, https://github.com/Ladas/manageiq-providers-amazon/blob/f9123d84236a66348c4bd05d499c74f94f6d7594/app/models/manageiq/providers/amazon/inventory/persister/cloud_manager.rb#L5 is a good place to have shared
Then we need to add it to cloud persitor:
https://github.com/Ladas/manageiq-providers-amazon/blob/f1a67bdf880ad381231e234962284c49717f5ea7/app/models/manageiq/providers/amazon/inventory/persister/cloud_manager.rb#L3
And also to target refresh persistor:
https://github.com/Ladas/manageiq-providers-amazon/blob/f1a67bdf880ad381231e234962284c49717f5ea7/app/models/manageiq/providers/amazon/inventory/persister/target_collection.rb#L2
For targeted refresh, we will need to add targeted_arel and parent_inventory_collections. Just enhanced arel condition we already have, it will look like https://github.com/Ladas/manageiq-providers-amazon/blob/f1a67bdf880ad381231e234962284c49717f5ea7/app/models/manageiq/providers/amazon/inventory_collection_default/cloud_manager.rb#L143 (so the condition will not have all Vms like in :arel, but only the limited set)
(targeted refresh specs share asserts with full refresh, so we should see it fail with missing tag)
@juliancheal please look closely at ManageIQ/manageiq-providers-kubernetes#162 and also add commits with specs @cben created https://github.com/ManageIQ/manageiq-providers-amazon/pull/382/files |
calling,
|
I've added @cben's specs to my PR and implemented more of the code you both suggested. |
I think you forgot to git push? |
Checked commits https://github.com/juliancheal/manageiq-providers-amazon/compare/6a212ee93fa1f48b9b62fb043b27c094c5dbfb4f~...58c2ab1f4db689fb066c1b3a817d8389239ef2cb with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0 app/models/manageiq/providers/amazon/inventory/parser/cloud_manager.rb
|
Superseded by #382 |
Fixes BZ https://bugzilla.redhat.com/show_bug.cgi?id=1506404
Tag mapping is missing for Amazon Graph refresh.