Bug 1431629 - undefined method during refresh EmbeddedAnsible Provider
Summary: undefined method during refresh EmbeddedAnsible Provider
Keywords:
Status: CLOSED ERRATA
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.8.0
Assignee: James Wong
QA Contact: Dmitry Misharov
URL:
Whiteboard: provider
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-13 13:29 UTC by Dmitry Misharov
Modified: 2017-05-31 14:41 UTC (History)
5 users (show)

Fixed In Version: 5.8.0.7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-05-31 14:41:44 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)
appliance log (734.21 KB, application/zip)
2017-03-13 13:29 UTC, Dmitry Misharov
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:1367 normal SHIPPED_LIVE Moderate: CFME 5.8.0 security, bug, and enhancement update 2017-05-31 18:16:03 UTC

Description Dmitry Misharov 2017-03-13 13:29:51 UTC
Created attachment 1262443 [details]
appliance log

Description of problem:
Items such as credentials, playbooks and repositories cannot be shown in CFME UI due the error in refresh procedure.

Version-Release number of selected component (if applicable):
5.8.0.4-nightly.20170310135842_5075263 

How reproducible:
Always

Steps to Reproduce:
1. Enable Embedded Ansible.
2. Add some project, inventory and template via embedded ansible tower ui.
3. Navigate to Automation->Ansible->Credentials, Playbooks or Repositories.

Actual results:
These screens are empty.

Expected results:
Appropriate items should be shown in that screens.

Additional info:
If you try to refresh embedded ansible provider manually with this command:
ManageIQ::Providers::EmbeddedAnsible::Provider.first.refresh_ems
you got such output:
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
=> [#<ManageIQ::Providers::EmbeddedAnsible::AutomationManager id: 1, name: "Embedded Ansible Automation Manager", created_on: "2017-03-13 10:24:37", updated_on: "2017-03-13 12:56:02", guid: "428c46e6-07d7-11e7-b1c1-001a4a44260e", zone_id: 1, type: "ManageIQ::Providers::EmbeddedAnsible::AutomationMa...", api_version: "3.1.0-0.git201702280600", uid_ems: nil, host_default_vnc_port_start: nil, host_default_vnc_port_end: nil, provider_region: nil, last_refresh_error: "undefined method `credential_id' for #<AnsibleTowe...", last_refresh_date: "2017-03-13 12:56:02", provider_id: 1, realm: nil, tenant_id: 1, project: nil, parent_ems_id: nil, subscription: nil, last_metrics_error: nil, last_metrics_update_date: nil, last_metrics_success_date: nil, tenant_mapping_enabled: nil>]
Pay attention to string "last_refresh_error: "undefined method `credential_id' for #<AnsibleTowe...""

Comment 3 Dmitry Misharov 2017-03-13 13:54:53 UTC
Stacktrace:
[----] E, [2017-03-13T06:41:32.047702 #15462:e35134] ERROR -- : /var/www/miq/vmdb/app/models/ems_refresh/refreshers/ems_refresher_mixin.rb:50:in `refresh'
/var/www/miq/vmdb/app/models/manageiq/providers/base_manager/refresher.rb:10:in `refresh'
/var/www/miq/vmdb/app/models/ems_refresh.rb:99:in `block in refresh'
/var/www/miq/vmdb/app/models/ems_refresh.rb:98:in `each'
/var/www/miq/vmdb/app/models/ems_refresh.rb:98:in `refresh'
/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:106:in `deliver_queue_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:134:in `deliver_message'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:152:in `block in do_work'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146:in `loop'
/var/www/miq/vmdb/app/models/miq_queue_worker_base/runner.rb:146: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:343: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:341:in `start_runner'
/var/www/miq/vmdb/app/models/miq_worker.rb:352:in `start'
/var/www/miq/vmdb/app/models/miq_worker.rb:270:in `start_worker'
/var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:68:in `start_worker_for_ems'
/var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:46:in `block in sync_workers'
/var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:45:in `each'
/var/www/miq/vmdb/app/models/mixins/per_ems_worker_mixin.rb:45: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/worker_management/monitor.rb:22:in `monitor_workers'
/var/www/miq/vmdb/app/models/miq_server.rb:348:in `block in monitor'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-0441a53b546e/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-0441a53b546e/lib/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block'
/var/www/miq/vmdb/app/models/miq_server.rb:348:in `monitor'
/var/www/miq/vmdb/app/models/miq_server.rb:370:in `block (2 levels) in monitor_loop'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-0441a53b546e/lib/gems/pending/util/extensions/miq-benchmark.rb:11:in `realtime_store'
/opt/rh/cfme-gemset/bundler/gems/manageiq-gems-pending-0441a53b546e/lib/gems/pending/util/extensions/miq-benchmark.rb:30:in `realtime_block'
/var/www/miq/vmdb/app/models/miq_server.rb:370:in `block in monitor_loop'
/var/www/miq/vmdb/app/models/miq_server.rb:369:in `loop'
/var/www/miq/vmdb/app/models/miq_server.rb:369:in `monitor_loop'
/var/www/miq/vmdb/app/models/miq_server.rb:252: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 4 James Wong 2017-03-13 17:49:43 UTC
Just a early findings:

For the dev-ansible-tower-3 we have,
 (byebug) collector.projects.collect(&:credential)
[nil, nil, 3, nil, nil, nil, nil, nil, nil]
(byebug) collector.projects.collect(&:credential_id)
[nil, nil, 3, nil, nil, nil, nil, nil, nil]
And it complete successfully
I am intercepting the refresh at https://github.com/jameswnl/manageiq/blob/c9e9ae107ecc16d13517f019c5616e33a268c1f7/app/models/manageiq/providers/ansible_tower/shared/inventory/parser/automation_manager.rb#L47


but for a newly downloaded Tower
 (byebug) collector.projects.collect(&:credential)
[nil]
(byebug) collector.projects.collect(&:credential_id)
*** NoMethodError Exception: undefined method `credential_id' for #<AnsibleTowerClient::Project:0x007feac176ea90>
Did you mean?  credential
               credential=

nil

Comment 6 CFME Bot 2017-03-16 19:06:33 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/853078d5ad49df5fa9ad9fae1582538a7c2d3015

commit 853078d5ad49df5fa9ad9fae1582538a7c2d3015
Author:     James Wong <jwong@redhat.com>
AuthorDate: Mon Mar 13 11:34:50 2017 -0400
Commit:     James Wong <jwong@redhat.com>
CommitDate: Thu Mar 16 13:28:25 2017 -0400

    check if project has credential before try to use it
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1431629

 .../ansible_tower/shared/inventory/parser/automation_manager.rb        | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comment 7 James Wong 2017-03-16 20:29:31 UTC
The cause to this problem is due to https://github.com/ansible/ansible_tower_client_ruby/issues/68

The reason that an existing Tower instance and the recorded vcr cassette for the spec tests don't have problem is: they have in the mix some projects that have credential associated and that would make the ruby class have the 'credential_id' field defined.

The newly deployed appliance in question has no projects with credential associated.

So this fix will eliminate our problem here (during refresh).

Comment 8 James Wong 2017-03-16 20:30:48 UTC
PR https://github.com/ManageIQ/manageiq/pull/14297 is merged to upstream.

Comment 9 Dmitry Misharov 2017-03-23 08:13:00 UTC
Verified in 5.8.0.7.20170321164727_1c97ccd. Embedded ansible data such as playbooks, credentials and repositories are shown in the ui.

Comment 11 errata-xmlrpc 2017-05-31 14:41:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:1367


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