ManageIQ / manageiq-ui-classic

Classic UI of ManageIQ
Apache License 2.0
50 stars 358 forks source link

Can't access my service ordered from Ansible Tower workflow template catalog item. #4444

Closed lfu closed 6 years ago

lfu commented 6 years ago

Found this error in development.log when testing https://github.com/ManageIQ/manageiq-providers-ansible_tower/pull/103.

[----] F, [2018-08-09T13:37:47.725841 #40129:3fd3136f44bc] FATAL -- : Error caught: [ActionView::Template::Error] undefined method `job_plays' for #<ManageIQ::Providers::AnsibleTower::AutomationManager::WorkflowJob:0x00007fa61db3b170>
/Users/lfu/.gem/ruby/2.4.2/gems/activemodel-5.0.7/lib/active_model/attribute_methods.rb:433:in `method_missing'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/helpers/service_helper/textual_summary.rb:300:in `fetch_job_plays'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/helpers/service_helper/textual_summary.rb:70:in `textual_group_tower_job_plays'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/helpers/textual_summary_helper.rb:67:in `block (2 levels) in process_textual_info'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/helpers/textual_summary_helper.rb:66:in `collect'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/helpers/textual_summary_helper.rb:66:in `block in process_textual_info'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/helpers/textual_summary_helper.rb:65:in `collect'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/helpers/textual_summary_helper.rb:65:in `process_textual_info'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/views/layouts/_textual_groups_tabs.html.haml:4:in `_plugins_manageiq_ui_classic_app_views_layouts__textual_groups_tabs_html_haml__1857542000748944144_70175840125600'

Steps to re-create the issue:

  1. Set up Workflow Template in Ansible Tower.
  2. Add above Ansible Tower as provider in MIQ.
  3. Add a new Ansible Tower catalog item based on the workflow template.
  4. Order the new added Ansible Tower catalog item.
  5. Access the new service under My Services.
h-kataria commented 6 years ago

@lfu looks like this issue is introduced with changes in https://github.com/ManageIQ/manageiq/pull/17712 by this line change https://github.com/ManageIQ/manageiq/pull/17712/files#diff-489c4924423f9722859b2decd6371911R21 cc @tumido See error trace below:

[----] F, [2018-08-10T15:00:37.005571 #32628:6e087dc] FATAL -- : Error caught: [ActionView::Template::Error] The single-table inheritance mechanism failed to locate the subclass: 'ManageIQ::Providers::AnsibleTower::AutomationManager::WorkflowJob'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite OrchestrationStack.inheritance_column to use another column for that information.
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/inheritance.rb:182:in `rescue in find_sti_class'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/inheritance.rb:175:in `find_sti_class'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/inheritance.rb:163:in `discriminate_class_for_record'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/persistence.rb:67:in `instantiate'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/querying.rb:50:in `block (2 levels) in find_by_sql'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/result.rb:52:in `block in each'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/result.rb:52:in `each'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/result.rb:52:in `each'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/querying.rb:50:in `map'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/querying.rb:50:in `block in find_by_sql'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activesupport-5.0.7/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/querying.rb:49:in `find_by_sql'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/statement_cache.rb:109:in `execute'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/associations/singular_association.rb:65:in `get_records'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/associations/singular_association.rb:69:in `find_target'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/associations/association.rb:148:in `load_target'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/associations/association.rb:53:in `reload'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/associations/singular_association.rb:14:in `reader'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activerecord-5.0.7/lib/active_record/associations/builder/association.rb:111:in `resource'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activesupport-5.0.7/lib/active_support/core_ext/object/try.rb:17:in `public_send'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activesupport-5.0.7/lib/active_support/core_ext/object/try.rb:17:in `try!'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activesupport-5.0.7/lib/active_support/core_ext/object/try.rb:6:in `try'
/home/hkataria/dev/manageiq/app/models/service_ansible_tower.rb:21:in `job'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activesupport-5.0.7/lib/active_support/core_ext/object/try.rb:17:in `public_send'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activesupport-5.0.7/lib/active_support/core_ext/object/try.rb:17:in `try!'
/home/hkataria/.rvm/gems/ruby-2.4.4/gems/activesupport-5.0.7/lib/active_support/core_ext/object/try.rb:6:in `try'
/home/hkataria/dev/manageiq-ui-classic/app/views/service/_svcs_show.html.haml:15:in `__home_hkataria_dev_manageiq_ui_classic_app_views_service__svcs_show_html_haml__2902916322992597572_69892921278580'
lfu commented 6 years ago

@h-kataria I made a change to app/helpers/service_helper/textual_summary.rb as you suggested:

def textual_group_tower_job_plays
    return nil unless fetch_job
    return nil unless @job.respond_to?(:job_plays)
    fetch_job_plays
end

Then the testing went further and hit another error:

[----] F, [2018-08-13T15:22:37.120113 #72904:3fdc866da2c0] FATAL -- : Error caught: [ActionView::Template::Error] undefined method `raw_stdout_via_worker' for #<ManageIQ::Providers::AnsibleTower::AutomationManager::WorkflowJob:0x00007fb913653dc0>
/Users/lfu/.gem/ruby/2.4.2/gems/activemodel-5.0.7/lib/active_model/attribute_methods.rb:433:in `method_missing'
/Users/lfu/code/miq/plugins/manageiq-ui-classic/app/views/service/_svcs_show.html.haml:45:in `block in _plugins_manageiq_ui_classic_app_views_service__svcs_show_html_haml___2342410185805835597_70216413423400'

which makes sense as raw_stdout_via_worker is a template job method, not available for a workflow job.

UI should treat workflow job and template job differently, not sharing one code.