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

Targeted refresh #153

Merged
merged 4 commits into from
Feb 6, 2019
Merged

Targeted refresh #153

merged 4 commits into from
Feb 6, 2019

Conversation

slemrmartin
Copy link
Contributor

@slemrmartin slemrmartin commented Jan 11, 2019

Targeted refresh for refreshing only specified inventory (and its subgraph) - like for amazon, azure etc.


@@ -1,3 +1,3 @@
class ManageIQ::Providers::AnsibleTower::AutomationManager::Refresher < ManageIQ::Providers::BaseManager::Refresher
class ManageIQ::Providers::AnsibleTower::AutomationManager::Refresher < ManageIQ::Providers::BaseManager::ManagerRefresher
Copy link
Member

@agrare agrare Jan 18, 2019

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

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 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.

Copy link
Contributor Author

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
Copy link
Member

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 ?

Copy link
Contributor Author

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

Copy link
Contributor Author

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

@agrare
Copy link
Member

agrare commented Jan 18, 2019

@jameswnl @Ladas can you review?

[nil]
end
else
endpoint.all(:id__in => refs.join(','))
Copy link
Contributor

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

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 hm, I didn't find it in documentation so I need to make additional spec

Copy link
Contributor Author

@slemrmartin slemrmartin Feb 5, 2019

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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

@slemrmartin
Copy link
Contributor Author

@agrare @Ladas review please.
I have to keep [wip] flag because of embedded ansible (I don't test it if it's working now - there is core dependency on this code)

@miq-bot
Copy link
Member

miq-bot commented Feb 1, 2019

Some comments on commits slemrmartin/manageiq-providers-ansible_tower@9de8377~...04d61e4

spec/vcr_cassettes/manageiq/providers/ansible_tower/automation_manager/refresher.yml

  • 💣 💥 🔥 🚒 - 1009 - Detected cfme
  • 💣 💥 🔥 🚒 - 1039 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1044 - Detected cfme
  • 💣 💥 🔥 🚒 - 1048 - Detected cfme
  • 💣 💥 🔥 🚒 - 1074 - Detected cfme
  • 💣 💥 🔥 🚒 - 1080 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1091 - Detected cfme
  • 💣 💥 🔥 🚒 - 1121 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1157 - Detected cfme
  • 💣 💥 🔥 🚒 - 1287 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1370 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1471 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1563 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1603 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1644 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 1684 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 2260 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 2302 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 2342 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 458 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 493 - Detected cfme
  • 💣 💥 🔥 🚒 - 543 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 580 - Detected cfme
  • 💣 💥 🔥 🚒 - 630 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 635 - Detected cfme
  • 💣 💥 🔥 🚒 - 639 - Detected cfme
  • 💣 💥 🔥 🚒 - 665 - Detected cfme
  • 💣 💥 🔥 🚒 - 671 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 6755 - Detected cfme
  • 💣 💥 🔥 🚒 - 682 - Detected cfme
  • 💣 💥 🔥 🚒 - 712 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 717 - Detected cfme
  • 💣 💥 🔥 🚒 - 721 - Detected cfme
  • 💣 💥 🔥 🚒 - 747 - Detected cfme
  • 💣 💥 🔥 🚒 - 753 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 7639 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 764 - Detected cfme
  • 💣 💥 🔥 🚒 - 7640 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 7649 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 7653 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 7718 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 794 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 799 - Detected cfme
  • 💣 💥 🔥 🚒 - 803 - Detected cfme
  • 💣 💥 🔥 🚒 - 829 - Detected cfme
  • 💣 💥 🔥 🚒 - 835 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 846 - Detected cfme
  • 💣 💥 🔥 🚒 - 876 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 881 - Detected cfme
  • 💣 💥 🔥 🚒 - 885 - Detected cfme
  • 💣 💥 🔥 🚒 - 911 - Detected cfme
  • 💣 💥 🔥 🚒 - 917 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 928 - Detected cfme
  • 💣 💥 🔥 🚒 - 957 - Detected cloudforms
  • 💣 💥 🔥 🚒 - 962 - Detected cfme
  • 💣 💥 🔥 🚒 - 966 - Detected cfme
  • 💣 💥 🔥 🚒 - 992 - Detected cfme
  • 💣 💥 🔥 🚒 - 998 - Detected cloudforms

@miq-bot
Copy link
Member

miq-bot commented Feb 1, 2019

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
16 files checked, 8 offenses detected

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]])
Copy link
Contributor Author

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 )

Copy link
Contributor

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

Copy link
Contributor Author

@slemrmartin slemrmartin Feb 4, 2019

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
@slemrmartin slemrmartin changed the title [WIP] Targeted refresh Targeted refresh Feb 5, 2019
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.

👍 looks good

@agrare this will break core specs so we should merge it together with the core PR

@slemrmartin
Copy link
Contributor Author

looks good

@agrare this will break core specs so we should merge it together with the core PR

https://github.com/ManageIQ/manageiq/blob/master/spec/models/manageiq/providers/embedded_ansible/automation_manager/refresher_configuration_script_source_spec.rb

this is one of the evil spec :)

@agrare agrare merged commit f9d95fb into ManageIQ:master Feb 6, 2019
agrare added a commit to agrare/manageiq-providers-ansible_tower that referenced this pull request Feb 6, 2019
…resh"

This reverts commit f9d95fb, reversing
changes made to dfcd8e8.
jameswnl added a commit that referenced this pull request Feb 6, 2019
Revert "Merge pull request #153 from slemrmartin/targeted-refresh"
@slemrmartin slemrmartin deleted the targeted-refresh branch February 7, 2019 08:20
@slemrmartin slemrmartin restored the targeted-refresh branch February 7, 2019 08:21
slemrmartin pushed a commit to slemrmartin/manageiq-providers-ansible_tower that referenced this pull request Feb 11, 2019
…resh"

This reverts commit f9d95fb, reversing
changes made to dfcd8e8.
slemrmartin added a commit to slemrmartin/manageiq-providers-ansible_tower that referenced this pull request Feb 11, 2019
it's revert of revert's PR ManageIQ#153
slemrmartin added a commit to slemrmartin/manageiq-providers-ansible_tower that referenced this pull request Feb 11, 2019
agrare added a commit that referenced this pull request Feb 11, 2019
Revert "Revert "Merge pull request #153 from slemrmartin/targeted-refresh"
@slemrmartin slemrmartin deleted the targeted-refresh branch February 12, 2019 15:22
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