Bug 1437042

Summary: Refresh doesn't remove the only and deleted ansible repository causing next deletion to fail
Product: Red Hat CloudForms Management Engine Reporter: Dmitry Misharov <dmisharo>
Component: ProvidersAssignee: Marcel Hild <mhild>
Status: CLOSED CURRENTRELEASE QA Contact: Kedar Kulkarni <kkulkarn>
Severity: high Docs Contact:
Priority: high    
Version: 5.8.0CC: dmisharo, hkataria, jfrey, jhardy, jwong, kkulkarn, mpovolny, nchugh, obarenbo, pakotvan
Target Milestone: GAKeywords: TestOnly
Target Release: 5.9.0   
Hardware: All   
OS: All   
Whiteboard: ansible:repo
Fixed In Version: 5.9.0.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1444508 (view as bug list) Environment:
Last Closed: 2018-03-06 15:11:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: CFME Core Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1444508    

Description Dmitry Misharov 2017-03-29 12:07:50 UTC
Description of problem:
It seems CFME keeps saved in the db ansible inventory after deleting. Therefore it can be visible from the UI, but can't be deleted.

Version-Release number of selected component (if applicable):
5.8.0.7-nightly.20170328151956_0fcdb72

How reproducible:
Always

Steps to Reproduce:
1. Navigate to Automation/Ansible/Repository.
2. Add an ansible repository.
3. Perform deletion of that repository.

Actual results:
Repository hasn't been deleted.

Expected results:
Repository should be deleted.

Additional info:
[----] E, [2017-03-29T07:40:24.369799 #14993:124f134] ERROR -- : AnsibleTowerClient::Middleware::RaiseTowerError Response Body:
{"detail"=>"Not found."}

[----] E, [2017-03-29T07:40:24.370035 #14993:124f134] ERROR -- : MIQ(MiqQueue#deliver) Message id: [1000000002889], Error: [{:status=>404, :headers=>{"date"=>"Wed, 29 Mar 2017 11:40:24 GMT", "server"=>"nginx/1.
10.2", "content-type"=>"application/json", "x-api-time"=>"0.025s", "allow"=>"GET, PUT, PATCH, DELETE, HEAD, OPTIONS", "content-language"=>"en", "vary"=>"Accept,Accept-Language,Cookie", "x-api-node"=>"localhost"
, "connection"=>"close", "transfer-encoding"=>"chunked"}, :body=>"{\"detail\":\"Not found.\"}"}]
[----] E, [2017-03-29T07:40:24.370151 #14993:124f134] ERROR -- : [AnsibleTowerClient::ResourceNotFoundError]: {:status=>404, :headers=>{"date"=>"Wed, 29 Mar 2017 11:40:24 GMT", "server"=>"nginx/1.10.2", "conten
t-type"=>"application/json", "x-api-time"=>"0.025s", "allow"=>"GET, PUT, PATCH, DELETE, HEAD, OPTIONS", "content-language"=>"en", "vary"=>"Accept,Accept-Language,Cookie", "x-api-node"=>"localhost", "connection"
=>"close", "transfer-encoding"=>"chunked"}, :body=>"{\"detail\":\"Not found.\"}"}  Method:[rescue in deliver]
[----] E, [2017-03-29T07:40:24.370260 #14993:124f134] ERROR -- : /opt/rh/cfme-gemset/gems/ansible_tower_client-0.10.0/lib/ansible_tower_client/middleware/raise_tower_error.rb:18:in `on_complete'
/opt/rh/cfme-gemset/gems/faraday-0.9.2/lib/faraday/response.rb:9:in `block in call'
/opt/rh/cfme-gemset/gems/faraday-0.9.2/lib/faraday/response.rb:57:in `on_complete'
/opt/rh/cfme-gemset/gems/faraday-0.9.2/lib/faraday/response.rb:8:in `call'
/opt/rh/cfme-gemset/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb:15:in `call'
/opt/rh/cfme-gemset/gems/faraday_middleware-0.10.1/lib/faraday_middleware/response/follow_redirects.rb:76:in `perform_with_redirection'
/opt/rh/cfme-gemset/gems/faraday_middleware-0.10.1/lib/faraday_middleware/response/follow_redirects.rb:64:in `call'
/opt/rh/cfme-gemset/gems/faraday_middleware-0.10.1/lib/faraday_middleware/request/encode_json.rb:23:in `call'
/opt/rh/cfme-gemset/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in `build_response'
/opt/rh/cfme-gemset/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in `run_request'
/opt/rh/cfme-gemset/gems/faraday-0.9.2/lib/faraday/connection.rb:140:in `get'
/opt/rh/cfme-gemset/gems/ansible_tower_client-0.10.0/lib/ansible_tower_client/api.rb:87:in `method_missing'
/opt/rh/cfme-gemset/gems/ansible_tower_client-0.10.0/lib/ansible_tower_client/collection.rb:30:in `find'
/var/www/miq/vmdb/app/models/manageiq/providers/ansible_tower/shared/automation_manager/configuration_script_source.rb:69:in `block in delete_in_provider'
/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/manageiq/providers/ansible_tower/shared/automation_manager/configuration_script_source.rb:68:in `delete_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:334:in `block in do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:331:in `loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:331:in `do_work_loop'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:153:in `run'
/var/www/miq/vmdb/app/models/miq_worker/runner.rb:128: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>'

Comment 3 James Wong 2017-03-31 15:43:11 UTC
*** Bug 1437416 has been marked as a duplicate of this bug. ***

Comment 4 James Wong 2017-03-31 15:57:21 UTC
Zita,

Seems like a backend issue. I'll take it from here. If it turns out differently, I'll return it :)

James

Comment 7 James Wong 2017-04-03 17:30:06 UTC
The cause is that:

There's a bug in refresh that if Tower doesn't return any project object, refresh won't do anything to the repo/configuration_script_source (CFME's internal representation of Tower project).

In your case, you had only 1 project. Then you issue a delete which succeeded in deleting it in Tower.  This operation would start a refresh which is supposed to sync up with Tower, i.e. finding out Tower is rid of the subject project and would remove the corresponding repo/configuration_script_source.

However due to the refresh bug, this is not done. So on CFME UI, you can still see the deleted repo.  Now if you try to delete it again, UI would allow you to do so, but Tower would complain that it doesn't have that thing and hence the error you see in the log.

Marcel is working on the fix to the refresh bug here https://github.com/ManageIQ/manageiq/pull/14612

I'm updating the bug title to reflect the findings and assigning to Marcel.

Comment 8 James Wong 2017-04-10 15:22:40 UTC
*** Bug 1439150 has been marked as a duplicate of this bug. ***

Comment 9 James Wong 2017-04-20 18:46:53 UTC
Marcel,

Your fix https://github.com/ManageIQ/manageiq/pull/14612 is in already. Anything else?

Comment 11 James Wong 2017-04-24 14:08:26 UTC
*** Bug 1444364 has been marked as a duplicate of this bug. ***

Comment 12 Kedar Kulkarni 2017-10-12 19:05:48 UTC
verified in 5.9.0.2