Bug 1287473

Summary: Accessing the ae_domains association of an MiqAeServiceTenant object causes error "uninitialized constant MiqAeMethodService::MiqAeServiceMiqAeDomain"
Product: Red Hat CloudForms Management Engine Reporter: Peter McGowan <pmcgowan>
Component: AutomateAssignee: mkanoor
Status: CLOSED ERRATA QA Contact: Dmitry Misharov <dmisharo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.5.0CC: dajohnso, jhardy, mkanoor, obarenbo, tfitzger
Target Milestone: GA   
Target Release: 5.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.6.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1288119 1288120 (view as bug list) Environment:
Last Closed: 2016-06-29 15:15:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1288119, 1288120    

Description Peter McGowan 2015-12-02 08:05:05 UTC
Description of problem:
The new MiqAeServiceTenant class has an association to ae_domains:

expose :ae_domains, :association => true

however when this association is accessed via an automate script, an error is generated:

MiqAeServiceModelBase.ar_method raised: <NameError>: <uninitialized constant MiqAeMethodService::MiqAeServiceMiqAeDomain>

...because there is no corresponding service model

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


How reproducible:
Every time

Steps to Reproduce:
1. Add a call to object_walker to a VMProvision_VM state machine instance
2. Provision a VM
3. Observe the error when object_walker traverses the associations of $evm.root['tenant']

Actual results:

[----] E, [2015-12-02T07:35:23.017981 #14760:90d6ee4] ERROR -- : Q-task_id([miq_provision_1000000000001]) MiqAeServiceModelBase.ar_method raised: <NameError>: <uninitialized constant MiqAeMethodService::MiqAeServiceMiqAeDomain>
[----] E, [2015-12-02T07:35:23.018243 #14760:90d6ee4] ERROR -- : Q-task_id([miq_provision_1000000000001]) /var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:116:in `const_get'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:116:in `block in wrap_results'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:261:in `ar_method'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:108:in `wrap_results'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:112:in `block (2 levels) in wrap_results'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:112:in `collect'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:112:in `block in wrap_results'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:261:in `ar_method'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:108:in `wrap_results'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:126:in `wrap_results'
/var/www/miq/vmdb/lib/miq_automation_engine/engine/miq_ae_service_model_base.rb:97:in `block (2 levels) in expose'
/opt/rh/rh-ruby22/root/usr/share/ruby/drb/drb.rb:1624:in `perform_without_block'
/opt/rh/rh-ruby22/root/usr/share/ruby/drb/drb.rb:1584:in `perform'
/opt/rh/rh-ruby22/root/usr/share/ruby/drb/drb.rb:1657:in `block (2 levels) in main_loop'
/opt/rh/rh-ruby22/root/usr/share/ruby/drb/drb.rb:1653:in `loop'
/opt/rh/rh-ruby22/root/usr/share/ruby/drb/drb.rb:1653:in `block in main_loop'

Expected results:
no error

Additional info:
object_walker was 1.6.2 from https://github.com/pemcg/object_walker

Comment 3 CFME Bot 2015-12-02 21:35:18 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/a0d8a7edc1f368f5daa39e0ce67615af4270d996

commit a0d8a7edc1f368f5daa39e0ce67615af4270d996
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Wed Dec 2 14:38:45 2015 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Wed Dec 2 14:38:45 2015 -0500

    Added Service Model for MiqAeDomain
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1287473
    
    Starting in 5.5 each domain is owned by a tenant, tenants have a
    relationship to domains. The Service Model for MiqAeDomain was not
    being defined. Added Service Model for MiqAeDomain & MiqAeNamespace

 .../service_models/miq_ae_service_miq_ae_domain.rb         |  4 ++++
 .../service_models/miq_ae_service_miq_ae_namespace.rb      |  4 ++++
 .../lib/miq_automation_engine/miq_ae_service_model_spec.rb | 14 ++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_miq_ae_domain.rb
 create mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_miq_ae_namespace.rb

Comment 4 mkanoor 2015-12-03 19:27:40 UTC
*** Bug 1288119 has been marked as a duplicate of this bug. ***

Comment 5 CFME Bot 2015-12-07 19:33:50 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=ff66e0be304af60180bbc3fa03b26a322a1d387a

commit ff66e0be304af60180bbc3fa03b26a322a1d387a
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Wed Dec 2 14:38:45 2015 -0500
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Wed Dec 2 16:37:04 2015 -0500

    Added Service Model for MiqAeDomain
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1287473
    
    Starting in 5.5 each domain is owned by a tenant, tenants have a
    relationship to domains. The Service Model for MiqAeDomain was not
    being defined. Added Service Model for MiqAeDomain & MiqAeNamespace

 .../service_models/miq_ae_service_miq_ae_domain.rb         |  4 ++++
 .../service_models/miq_ae_service_miq_ae_namespace.rb      |  4 ++++
 .../lib/miq_automation_engine/miq_ae_service_model_spec.rb | 14 ++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_miq_ae_domain.rb
 create mode 100644 lib/miq_automation_engine/service_models/miq_ae_service_miq_ae_namespace.rb

Comment 6 Milan Falešník 2016-05-27 08:38:50 UTC
Verified in 5.6.0.8, both in provision and in rails console, the .ae_domains relationship of tenant is working.

Comment 8 errata-xmlrpc 2016-06-29 15:15:07 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/RHBA-2016:1348