Bug 1465826 - Accessing the 'manager' association of a ManageIQ_Providers_EmbeddedAnsible_AutomationManager_Job service model gives a NoMethodError exception
Accessing the 'manager' association of a ManageIQ_Providers_EmbeddedAnsible_A...
Status: ON_QA
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate (Show other bugs)
5.8.0
Unspecified Unspecified
medium Severity medium
: GA
: 5.9.0
Assigned To: Lucy Fu
Dmitry Misharov
ansible_embed:automate
: TestOnly, ZStream
Depends On:
Blocks: 1478515
  Show dependency treegraph
 
Reported: 2017-06-28 05:58 EDT by Peter McGowan
Modified: 2017-10-05 22:21 EDT (History)
5 users (show)

See Also:
Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1478515 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Peter McGowan 2017-06-28 05:58:39 EDT
Description of problem:
A ManageIQ_Providers_EmbeddedAnsible_AutomationManager_Job service model appears to have 3 associations named 'manager', however accessing this association results in a NoMethodError exception, as follows:

irb(main):009:0> job = $evm.vmdb('ManageIQ_Providers_EmbeddedAnsible_AutomationManager_Job').first
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0

irb(main):010:0> job.associations
=> ["ext_management_system", "manager", "manager", "manager", "outputs", "parameters", "resources"]

irb(main):011:0> job.manager
PostgreSQLAdapter#log_after_checkout, connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0
PostgreSQLAdapter#log_after_checkin, connection_pool: size: 5, connections: 1, in use: 0, waiting_in_queue: 0
NoMethodError: undefined method `manager' for #<ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Job:0x0000000a386bc0>
	from /opt/rh/cfme-gemset/gems/activemodel-5.0.3/lib/active_model/attribute_methods.rb:433:in `method_missing'
	from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:266:in `public_send'
	from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:266:in `block in object_send'
	from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:285:in `ar_method'
	from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:295:in `ar_method'
	from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:264:in `object_send'
	from /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_method_service/miq_ae_service_model_base.rb:119:in `block (2 levels) in expose'
	from (irb):11
	from /opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/commands/console.rb:65:in `start'
	from /opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/commands/console_helper.rb:9:in `start'
	from /opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:78:in `console'
	from /opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
	from /opt/rh/cfme-gemset/gems/railties-5.0.3/lib/rails/commands.rb:18:in `<top (required)>'
	from bin/rails:4:in `require'
	from bin/rails:4:in `<main>'

Version-Release number of selected component (if applicable):
Found on 5.8.0.16

How reproducible:
Every time

Steps to Reproduce:
1. job = $evm.vmdb('ManageIQ_Providers_EmbeddedAnsible_AutomationManager_Job').first
2. job.associations
3. job.manager

Actual results:
NoMethodError exception

Expected results:
the association should be traversed

Additional info:
It looks like:

class MiqAeServiceManageIQ_Providers_EmbeddedAnsible_AutomationManager_Job < MiqAeServiceManageIQ_Providers_EmbeddedAutomationManager_OrchestrationStack
(exposes manager)

class MiqAeServiceManageIQ_Providers_EmbeddedAutomationManager_OrchestrationStack < MiqAeServiceManageIQ_Providers_AutomationManager_OrchestrationStack
(exposes manager)

class MiqAeServiceManageIQ_Providers_AutomationManager_OrchestrationStack < MiqAeServiceOrchestrationStack
(exposes manager)

class MiqAeServiceOrchestrationStack < MiqAeServiceModelBase
(manager is not exposed here)


This seems to be why we have 3 'manager' associations from the ManageIQ_Providers_EmbeddedAnsible_AutomationManager_Job object, but it needs to be exposed from MiqAeServiceOrchestrationStack
Comment 4 CFME Bot 2017-07-05 17:29:14 EDT
New commit detected on ManageIQ/manageiq-automation_engine/master:
https://github.com/ManageIQ/manageiq-automation_engine/commit/751893848d14403413d54d8c4d81fe84720d33dc

commit 751893848d14403413d54d8c4d81fe84720d33dc
Author:     Lucy Fu <lufu@redhat.com>
AuthorDate: Wed Jul 5 16:47:11 2017 -0400
Commit:     Lucy Fu <lufu@redhat.com>
CommitDate: Wed Jul 5 16:47:11 2017 -0400

    Remove the expose of manager to Embedded Ansible Job in service model.
    
    The :manager association to Embedded Ansible Job does not exist in the model side.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1465826

 ...vice_manageiq-providers-automation_manager-orchestration_stack.rb | 5 -----
 ...ice_manageiq-providers-embedded_ansible-automation_manager-job.rb | 5 -----
 ...geiq-providers-embedded_automation_manager-orchestration_stack.rb | 5 -----
 3 files changed, 15 deletions(-)
 delete mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-automation_manager-orchestration_stack.rb
 delete mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-embedded_ansible-automation_manager-job.rb
 delete mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-embedded_automation_manager-orchestration_stack.rb

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