-
Notifications
You must be signed in to change notification settings - Fork 54
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
Targeted refresh #153
Targeted refresh #153
Conversation
d5f2302
to
d831f1f
Compare
@@ -1,3 +1,3 @@ | |||
class ManageIQ::Providers::AnsibleTower::AutomationManager::Refresher < ManageIQ::Providers::BaseManager::Refresher | |||
class ManageIQ::Providers::AnsibleTower::AutomationManager::Refresher < ManageIQ::Providers::BaseManager::ManagerRefresher |
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.
@slemrmartin is this required? I'm trying to remove ManagerRefresher in another PR
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 it raises error when I'm refreshing ConfigurationScriptSource
with Refresher.
I think there is error in collector_inventory_for_targets()
. In ManagerRefresher
, it derives Collector class in Inventory
, there it tries to do by itself (https://github.com/ManageIQ/manageiq/blob/master/app/models/manageiq/providers/base_manager/refresher.rb#L141). This construction doesn't work for TargetCollection.
Then it calls parse_targeted_inventory
with collector == nil
.
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.
sorry, for InventoryRefresh::Target
it doesn't work...it contantizes ManageIQ::Providers::AnsibleTower::Inventory::Collector::Target
instead of ManageIQ::Providers::AnsibleTower::Inventory::Collector::TargetCollection
|
||
def initialize(_manager, _target) | ||
super | ||
end |
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.
Why is this needed if all it does is super
?
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.
it's not, I'll remove it
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.
it's needed now :) it adds dependent targets
[nil] | ||
end | ||
else | ||
endpoint.all(:id__in => refs.join(',')) |
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.
check if there is a limit for this, e.g. for amazon, you can search for max 200 ids. Then you can do something like the multi_query here https://github.com/Ladas/manageiq-providers-amazon/blob/4197be8d1dee08a18c87483cf5ada03bebb6f5c1/app/models/manageiq/providers/amazon/inventory/collector/target_collection.rb#L23 , which is just an iterator
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.
@Ladas hm, I didn't find it in documentation so I need to make additional spec
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.
@Ladas The only limit I found is URI length, then it returns HTTP 414 Request uri too large
. It can be 2083 characters and depends on length of tower api's URL.
I thing splitting to 200-length query should be enough (manager-refs are IDS, so we can expect it should match this condition theoretically for 8-digit comma-separated ids).
|
||
# @param collection [Symbol] inventory collection name (as identified in persister's definitions) | ||
def references(collection) | ||
manager_ref = manager_ref_by_collection(collection) |
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.
hm I would probably do this explicitly, rather than than building tmp persister? Most of the manage_ref are the same, aren't they?
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 want to have definition of manager_ref on 1 place rather than repeating the same on two places and ansible tower inventories doesn't have manager_ref
column for all inventories
Refactoring to Shared modules
d831f1f
to
04d61e4
Compare
Some comments on commits slemrmartin/manageiq-providers-ansible_tower@9de8377~...04d61e4 spec/vcr_cassettes/manageiq/providers/ansible_tower/automation_manager/refresher.yml
|
Checked commits slemrmartin/manageiq-providers-ansible_tower@9de8377~...04d61e4 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 lib/tasks_private/spec_helper.rake
spec/support/ansible_shared/automation_manager/refresh_configuartion_script_source.rb
spec/support/ansible_shared/automation_manager/refresh_targeted.rb
|
@@ -47,7 +49,11 @@ | |||
configuration_script_payloads = configuration_script_source.configuration_script_payloads | |||
|
|||
VCR.use_cassette(cassette_path) do | |||
EmsRefresh.refresh([[configuration_script_source.class.to_s, configuration_script_source.id]]) | |||
# EmsRefresh.refresh([[configuration_script_source.class.to_s, configuration_script_source.id]]) |
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.
@jameswnl @agrare @Ladas previous "like-targeted" refresh of configuration_script_sources have its own collector/parser/persister classes but I don't know if it uses InventoryRefresh::Target
in real or not.
I should remove these 3 classes.
But I'm not sure how is it used in production, if it's ok to work only with InventoryRefresh::Target
or not (ConfigurationScriptSource
is not on allowed list in EmsRefresh.get_target_objects
)
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.
So if the class wasn't listed in https://github.com/Ladas/manageiq/blob/3227d2b7f73da39db5f6b52b079977e2e32312e9/app/models/ems_refresh.rb#L136 , I suppose it never worked.
Since the target wouldn't go through EmsRefresh.queue_refresh
, which is used in production workflow
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.
anyway, this change is needed there but brokes embedded ansible specs from core (this is shared example) so there is cycle dependency
Also added hello_workflow configuration_workflow to populate_tower rake task
04d61e4
to
bac0298
Compare
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 good
@agrare this will break core specs so we should merge it together with the core PR
this is one of the evil spec :) |
Revert "Merge pull request #153 from slemrmartin/targeted-refresh"
it's revert of revert's PR ManageIQ#153
…eted-refresh"" This reverts commit 7165fec.
Revert "Revert "Merge pull request #153 from slemrmartin/targeted-refresh"
Targeted refresh for refreshing only specified inventory (and its subgraph) - like for amazon, azure etc.