Bug 1445995 - Ansible Playbook repo's do not load playbooks after editing
Summary: Ansible Playbook repo's do not load playbooks after editing
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.9.0
Assignee: James Wong
QA Contact: Dmitry Misharov
URL:
Whiteboard: ansible
: 1444381 1447292 (view as bug list)
Depends On:
Blocks: 1448098
TreeView+ depends on / blocked
 
Reported: 2017-04-26 23:44 UTC by Shveta
Modified: 2018-03-06 14:50 UTC (History)
13 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1448098 (view as bug list)
Environment:
Last Closed: 2018-03-06 14:50:47 UTC
Category: ---
Cloudforms Team: Ansible
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
two repo with same url (78.38 KB, image/png)
2017-04-26 23:44 UTC, Shveta
no flags Details
evm log (875.53 KB, text/plain)
2017-04-27 18:55 UTC, Shveta
no flags Details
evm1.log (716.35 KB, text/plain)
2017-04-27 18:56 UTC, Shveta
no flags Details
evm log (18.46 MB, text/plain)
2017-05-01 18:49 UTC, Shveta
no flags Details

Description Shveta 2017-04-26 23:44:23 UTC
Created attachment 1274470 [details]
two repo with same url

Description of problem:


Version-Release number of selected component (if applicable):
5.8.0.12-rc1.20170425180304_4f35996 

How reproducible:


Steps to Reproduce:
1. Create a repo in Ansible - Repositories with a wrong url.
Ex: https://github.com/sshveta/Ansible_Playbooks/vmware
2. Playbooks are not loaded. 
3. Edit the repo and correct the url to https://github.com/sshveta/Ansible_Playbooks , Playbooks are still not displayed.
4. Add a new repo with this url , Playbooks will be loaded.

Actual results:


Expected results:


Additional info:

Comment 2 James Wong 2017-04-27 15:03:41 UTC
Shveta,

Can you upload the evm.log?

thanks,
James

Comment 3 Shveta 2017-04-27 18:55:31 UTC
Created attachment 1274759 [details]
evm log

Comment 4 Shveta 2017-04-27 18:56:35 UTC
Created attachment 1274760 [details]
evm1.log

Added another repo(repo_1) with same url .

Comment 5 Shveta 2017-04-27 18:58:30 UTC
Appliance - https://10.8.198.122
Note : To refresh On Ansible - Repository page - I selected the checkbox for the repo and Configuration - refresh.(from the all repo page )


I think the repository gets refreshed when you click on the repo(not checkbox) and then refresh (from the individual repo page )

Comment 6 Greg Blomquist 2017-05-01 14:40:05 UTC
James, is this just a problem that the UI is calling a full refresh and not calling the targeted refresh from the repo list page?

Comment 8 James Wong 2017-05-01 15:47:19 UTC
The log shows there are 2 create_in_provider of repos.

1) failed because Tower complained that there's already an existing one with the same name 'test_repo'

[----] I, [2017-04-27T13:11:31.438598 #2948:d6d134]  INFO -- : MIQ(MiqPriorityWorker::Runner#get_message_via_drb) Message id: [17737], MiqWorker id: [47], Zone: [default], Role: [ems_operations], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource.
create_in_provider], Timeout: [600], Priority: [20], State: [dequeue], Deliver On: [], Data: [], Args: [2, {:name=>"test_repo", :description=>"", :scm_type=>"git", :scm_url=>"https://github.com/sshveta/Ansible_Playbooks", :authentication_id=>nil, :scm_branch=>"", :scm_clean=>false, :scm_delete_on_update=>false, :scm_update_on_launch=>true}], Dequeued in: [4.6264
55743] seconds
[----] E, [2017-04-27T13:11:31.566194 #2948:d6d134] ERROR -- : AnsibleTowerClient::Middleware::RaiseTowerError Response Body:
{"name"=>["Project with this Name already exists."]}


2) 2nd one succeeded with repo name = 'repo_1'. 

[----] I, [2017-04-27T13:16:02.058644 #2956:d6d134]  INFO -- : MIQ(MiqPriorityWorker::Runner#get_message_via_drb) Message id: [17777], MiqWorker id: [48], Zone: [default], Role: [ems_operations], Server: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource.create_in_provider], Timeout: [600], Priority: [20], State: [dequeue], Deliver On: [], Data: [], Args: [2, {:name=>"repo_1", :description=>"", :scm_type=>"git", :scm_url=>"https://github.com/sshveta/Ansible_Playbooks/blob/master/vmware/Install_Apache.yml", :authentication_id=>nil, :scm_branch=>"", :scm_clean=>false, :scm_delete_on_update=>false, :scm_update_on_launch=>true}], Dequeued in: [3.6370567] seconds


I couldn't find logs related to the repo name='sshveta_repo' as shown in your screen shot.


With the story https://www.pivotaltracker.com/story/show/143133279 now done (UI PR missed last built and will be there in tomorrow's appliance build), you'll be able to see if a repo failed to sync (Tower side). I.e. if the url is a wrong one, (or due to other factors) and Tower fails to get the list of playbooks (into Tower's own db), MIQ UI would show you the status.

What we need to do is to activate the target refresh on the repo being created/updated and so that playbooks will be loaded right away.

Comment 9 Greg Blomquist 2017-05-01 18:41:59 UTC
James, won't this be done by events?  For example, as soon as MIQ creates the repo in Ansible, Ansible should emit an event caught by MIQ, which should trigger the targeted refresh.

Also, you might be able to kick off a targeted refresh when updating a repo, but I'm not sure you will be able to do a targeted refresh when creating a repo.  There's no object to target.  And, the only work around I've seen in this case involves a targeted refresh based on an event.

For that, you'd probably have to rope in Adam to get some pointers.

Comment 10 James Wong 2017-05-01 18:46:46 UTC
Yes,

I am working on a PR to invoke targeted refresh when updating/deleting the repo. Right, for creation, I can't (efficiently).

Not sure if event is triggering targeted refresh. That'd be ideal and handle all cases. Let me check. Thanks for the lead.

Comment 11 Shveta 2017-05-01 18:48:44 UTC
Another appliance : https://10.8.198.207 .



EVM log 
==============================

m_clean=>false, :scm_delete_on_update=>false, :scm_update_on_launch=>true, :href=>"https://10.8.198.207/api/configuration_script_sources/1", :id=>1, :manager_id=>2, :manager_ref=>"6", :created_at=>"2017-05-01T18:29:58Z", :updated_at=>"2017-05-01T18:29:58Z", :type=>"ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource", :status=>"failed", :actions=>[{:name=>"edit", :method=>"post", :href=>"https://10.8.198.207/api/configuration_script_sources/1"}, {:name=>"delete", :method=>"post", :href=>"https://10.8.198.207/api/configuration_script_sources/1"}, {:name=>"delete", :method=>"delete", 
:href=>"https://10.8.198.207/api/configuration_script_sources/1"}], :task_id=>14}], Dequeued in: [1.205810535] seconds
[----] I, [2017-05-01T14:34:13.968467 #2868:781130]  INFO -- : MIQ(MiqQueue#deliver) Message id: [3621], Delivering...
[----] I, [2017-05-01T14:34:13.978873 #2868:781130]  INFO -- : MIQ(ManageIQ::Providers::EmbeddedAnsible::Provider#with_provider_connection) Connecting through ManageIQ::Providers::EmbeddedAnsible::Provider: [Embedded Ansible]
[----] E, [2017-05-01T14:34:14.331913 #2868:781130] ERROR -- : MIQ(MiqQueue#deliver) Message id: [3621], Error: [undefined method `href=' for #<AnsibleTowerClient::Project:0x000000154e9458>]
[----] E, [2017-05-01T14:34:14.332536 #2868:781130] ERROR -- : [NoMethodError]: undefined method `href=' for #<AnsibleTowerClient::Project:0x000000154e9458>  Method:[rescue in deliver]
[----] E, [2017-05-01T14:34:14.332619 #2868:781130] ERROR -- : /opt/rh/cfme-gemset/gems/ansible_tower_client-0.12.1/lib/ansible_tower_client/base_model.rb:88:in `block in update_attributes!'


/opt/rh/cfme-gemset/gems/ansible_tower_client-0.12.1/lib/ansible_tower_client/base_model.rb:84:in `each'
/opt/rh/cfme-gemset/gems/ansible_tower_client-0.12.1/lib/ansible_tower_client/base_model.rb:84:in `update_attributes!'
/var/www/miq/vmdb/app/models/manageiq/providers/ansible_tower/shared/automation_manager/tower_api.rb:67:in `block in update_in_provider'
/var/www/miq/vmdb/app/models/mixins/provider_object_mixin.rb:15:in `block in with_provider_object'
/var/www/miq/vmdb/app/models/provider.rb:49:in `with_provider_connection'
/var/www/miq/vmdb/app/models/manageiq/providers/ansible_tower/shared/automation_manager.rb:5:in `with_provider_connection'
/var/www/miq/vmdb/app/models/mixins/provider_object_mixin.rb:12:in `with_provider_object'
/var/www/miq/vmdb/app/models/manageiq/providers/ansible_tower/shared/automation_manager/tower_api.rb:66:in `update_in_provider'
/var/www/miq/vmdb/app/models/miq_queue.rb:347:in `block in deliver'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:91:in `block in timeout'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `block in catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:33:in `catch'
/opt/rh/rh-ruby23/root/usr/share/ruby/timeout.rb:106:in `timeout'
/var/www/miq/vmdb/app/models/miq_queue.rb:343:in `deliver'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:107:in `deliver_queue_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:135:in `deliver_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:153:in `block in do_work'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:147:in `loop'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:147:in `do_work'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:336:in `block in do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:333:in `loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:333:in `do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:155:in `run'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:130:in `start'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:21:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:339:in `block in start_runner'
/opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'
/opt/rh/cfme-gemset/gems/nakayoshi_fork-0.0.3/lib/nakayoshi_fork.rb:24:in `fork'
/var/www/miq/vmdb/app/models/miq_worker.rb:337:in `start_runner'
/var/www/miq/vmdb/app/models/miq_worker.rb:348:in `start'
/var/www/miq/vmdb/app/models/miq_worker.rb:266:in `start_worker'
/var/www/miq/vmdb/app/models/miq_worker.rb:150:in `block in sync_workers'
/var/www/miq/vmdb/app/models/miq_worker.rb:150:in `times'
/var/www/miq/vmdb/app/models/miq_worker.rb:150:in `sync_workers'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:53:in `block in sync_workers'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `each'
/var/www/miq/vmdb/app/models/miq_server/worker_management/monitor.rb:50:in `sync_workers'
/var/www/miq/vmdb/app/models/miq_server.rb:160:in `start'
/var/www/miq/vmdb/app/models/miq_server.rb:251:in `start'
/var/www/miq/vmdb/lib/workers/evm_server.rb:65:in `start'
/var/www/miq/vmdb/lib/workers/evm_server.rb:91:in `start'
/var/www/miq/vmdb/lib/workers/bin/evm_server.rb:4:in `<main>'
[----] I, [2017-05-01T14:34:14.333298 #2868:781130]  INFO -- : MIQ(MiqQueue#delivered) Message id: [3621], State: [error], Delivered in [0.364837067] seconds
[----] I, [2017-05-01T14:34:14.335114 #2868:781130]  INFO -- : MIQ(MiqQueue#m_callback) Message id: [3621], Invoking Callback with args: ["Finished", "error", "undefined method `href=' for #<AnsibleTowerClient::Project:0x000000154e9458>", "nil"]
[----] I, [2017-05-01T14:34:14.335453 #2868:781130]  INFO -- : MIQ(MiqTask#update_status) Task: [14] [Finished] [Error] [undefined method `href=' for #<AnsibleTowerClient::Project:0x000000154e9458>]
[----] I, [2017-05-01T14:34:17.463965 #2878:781130]  INFO -- : MIQ(MiqScheduleWorker::Runner#do_work) Number of scheduled items to be processed: 5.
[----] I, [2017-05-01T14:34:17.469713 #2878:781130]  INFO -- : MIQ(MiqQueue.put) Message id: [3622],  id: [], Zone: [default], Role: [], Server: [cbbfd368-2a0c-11e7-a8b6-001a4a4475a7], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [MiqServer.status_update], Timeout: [600], Priority: [20], State: [ready], Deliver On: [], Data: [], Args: []

Comment 12 Shveta 2017-05-01 18:49:53 UTC
Created attachment 1275463 [details]
evm log

Comment 13 James Wong 2017-05-01 18:55:36 UTC
:type=>"ManageIQ::Providers::EmbeddedAnsible::AutomationManager::ConfigurationScriptSource", :status=>"failed", :actions=>[{:name=>"edit", :method=>"post", :href=>"https://10.8.198.207/api/configuration_script_sources/1"}, {:name=>"delete", :method=>"post", :href=>"https://10.8.198.207/api/configuration_script_sources/1"}, {:name=>"delete", :method=>"delete", 
:href=>"https://10.8.198.207/api/configuration_script_sources/1"}], :task_id=>14}

UI is sending in extra stuff that fails Ansible Tower Ruby Client again.

Comment 15 Shveta 2017-05-01 22:22:37 UTC
Hi , Please Note that If I click on the repo and refresh it from the individual repo page , I too see the playbooks .

The error is when I refresh the repo from the all repo page(add new repo page) , means - click on the checkbox for the repo and refresh , It doesn't refresh.

Comment 17 Marcel Hild 2017-05-02 10:30:08 UTC
Laura, Shevta the discrepancy between details view and list view was fixed in https://github.com/ManageIQ/manageiq-ui-classic/pull/1176

Comment 18 Dmitry Misharov 2017-05-02 13:47:09 UTC
*** Bug 1447292 has been marked as a duplicate of this bug. ***

Comment 19 lgalis 2017-05-02 18:54:15 UTC
Assign back to James to add a refresh after a provider edit.

Comment 20 lgalis 2017-05-03 00:24:29 UTC
PR for the extra attributes sent by the UI for repository edit: https://github.com/ManageIQ/manageiq-ui-classic/pull/1230

Comment 21 Greg Blomquist 2017-05-04 13:40:40 UTC
https://github.com/ManageIQ/manageiq/pull/14954

Comment 23 James Wong 2017-05-08 23:19:29 UTC
A second PR is merged https://github.com/ManageIQ/manageiq/pull/15025


Now we are done.

Comment 24 James Wong 2017-05-22 21:53:21 UTC
*** Bug 1444381 has been marked as a duplicate of this bug. ***

Comment 25 Dmitry Misharov 2017-10-12 09:13:56 UTC
Verified in 5.9.0.2.20171010190026_0413a06. Playbooks are loaded after repository's editing.


Note You need to log in before you can comment on or make changes to this bug.