Bug 1546995 - internal server error when accessing the "policy_events" attribute of the "vms" resource
Summary: internal server error when accessing the "policy_events" attribute of the "vm...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: GA
: 5.10.0
Assignee: Gregg Tanzillo
QA Contact: Martin Kourim
URL:
Whiteboard: api:rest
Depends On:
Blocks: 1558030 1558032
TreeView+ depends on / blocked
 
Reported: 2018-02-20 10:08 UTC by Martin Kourim
Modified: 2018-07-30 14:44 UTC (History)
4 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1558030 1558032 (view as bug list)
Environment:
Last Closed: 2018-07-30 14:44:04 UTC
Category: ---
Cloudforms Team: ---


Attachments (Terms of Use)

Description Martin Kourim 2018-02-20 10:08:14 UTC
Description of problem:
When accessing the "policy_events" attribute of the "vms" resource the request fails with bad request error:
{
    "error": {
        "kind": "internal_server_error",
        "message": "undefined local variable or method `id' for #<ActiveRecord::Relation []>\nDid you mean?  ids",
        "klass": "NameError"
    }
}


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


How reproducible:
100%


Steps to Reproduce:
GET /api/vms/:id?attributes=policy_events

Comment 3 CFME Bot 2018-03-16 15:47:29 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/adc676cb3bf11cd314aff3be55715adfc6a4eba8
commit adc676cb3bf11cd314aff3be55715adfc6a4eba8
Author:     Jillian Tullo <jtullo@redhat.com>
AuthorDate: Thu Feb 22 07:29:16 2018 -0500
Commit:     Jillian Tullo <jtullo@redhat.com>
CommitDate: Thu Feb 22 07:29:16 2018 -0500

    Fix policy_events relationship on VmOrTemplate

    The policy_events relationship currently results in an internal server error because it is referencing "id" which is not valid

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1546995

 app/models/vm_or_template.rb | 2 +-
 spec/models/vm_or_template_spec.rb | 8 +
 2 files changed, 9 insertions(+), 1 deletion(-)

Comment 7 Dave Johnson 2018-07-30 14:44:04 UTC
Closing this as its already been verified in two z-streams and has test coverage around it.


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