Bug 1546112

Summary: internal server error when cloud_networks, cloud_subnets or security_groups subcolls requested on RHEVM
Product: Red Hat CloudForms Management Engine Reporter: Martin Kourim <mkourim>
Component: APIAssignee: Gregg Tanzillo <gtanzill>
Status: CLOSED CURRENTRELEASE QA Contact: Martin Kourim <mkourim>
Severity: medium Docs Contact:
Priority: high    
Version: 5.9.0CC: obarenbo, simaishi, smallamp
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.10.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: api:rest:provider
Fixed In Version: 5.10.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1552826 (view as bug list) Environment:
Last Closed: 2019-02-11 13:58:43 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: 1552826    

Description Martin Kourim 2018-02-16 11:09:04 UTC
Description of problem:
When accessing "cloud_networks", "cloud_subnets" or "security_groups" subcollection on RHEVM provider the request fails with internal server error:
{
    "error": {
        "kind": "internal_server_error",
        "message": "undefined method `all' for nil:NilClass",
        "klass": "NoMethodError"
    }
}


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


How reproducible:
100%


Steps to Reproduce:
1. add RHEVM provider
2. request the "cloud_networks", "cloud_subnets" or "security_groups" subcollection
GET /api/providers/:id/cloud_networks
GET /api/providers/:id/cloud_subnets
GET /api/providers/:id/security_groups

Comment 2 CFME Bot 2018-02-16 15:11:28 UTC
New commit detected on ManageIQ/manageiq-api/master:
https://github.com/ManageIQ/manageiq-api/commit/2fd9ee9d9b51918a010a212972268ca0ab6d1a9f

commit 2fd9ee9d9b51918a010a212972268ca0ab6d1a9f
Author:     Jillian Tullo <jtullo>
AuthorDate: Fri Feb 16 09:48:01 2018 -0500
Commit:     Jillian Tullo <jtullo>
CommitDate: Fri Feb 16 09:48:01 2018 -0500

    Ensure array is returned for subcollections
    
    Some providers return nil for cloud_networks, cloud_subnets, and security_groups, causing an internal server error to be raised.
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1546112

 .../api/subcollections/cloud_networks.rb           |  2 +-
 .../api/subcollections/cloud_subnets.rb            |  2 +-
 .../api/subcollections/security_groups.rb          |  2 +-
 spec/requests/providers_spec.rb                    | 32 ++++++++++++++++++++++
 4 files changed, 35 insertions(+), 3 deletions(-)

Comment 5 Martin Kourim 2018-06-28 11:08:10 UTC
Verified on 5.10.0.2 using our test automation