Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1510215 - wrong type value in orchestration_templates create request results in internal server error
Summary: wrong type value in orchestration_templates create request results in interna...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: GA
: 5.10.0
Assignee: Gregg Tanzillo
QA Contact: Martin Kourim
URL:
Whiteboard: api:rest
Depends On:
Blocks: 1513117
TreeView+ depends on / blocked
 
Reported: 2017-11-06 23:51 UTC by Martin Kourim
Modified: 2018-06-21 20:43 UTC (History)
2 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1513117 (view as bug list)
Environment:
Last Closed: 2018-06-21 20:43:09 UTC
Category: ---
Cloudforms Team: ---


Attachments (Terms of Use)

Description Martin Kourim 2017-11-06 23:51:20 UTC
Description of problem:
When specifying wrong value of a "type" attribute in the orchestration_templates create request, the request fails with internal server error.


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


How reproducible:
very


Steps to Reproduce:
POST /api/orchestration_templates
{
    "action": "create",
    "name": "test_tmplt",
    "description": "Test Template",
    "type": "OrchestrationTemplateCfn",
    "orderable": false,
    "draft": false,
    "content": {
        "AWSTemplateFormatVersion" : "2010-09-09",
        "Description" : "AWS TEST Sample Template Rails_Single_Instance.",
        "Parameters" : {
            "KeyName": {
                "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
                "Type": "AWS::EC2::KeyPair::KeyName",
                "ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
            }
        }
    }
}

Response:
{
    "error": {
        "kind": "internal_server_error",
        "message": "uninitialized constant OrchestrationTemplateCfn",
        "klass": "NameError"
    }
}


Expected results:
graceful fail

Comment 3 CFME Bot 2017-11-10 18:05:28 UTC
New commit detected on ManageIQ/manageiq-api/master:
https://github.com/ManageIQ/manageiq-api/commit/cfcc28b34eba1de2bee69b40c90e35edb31fefc9

commit cfcc28b34eba1de2bee69b40c90e35edb31fefc9
Author:     Jillian Tullo <jtullo@redhat.com>
AuthorDate: Thu Nov 9 15:53:52 2017 -0500
Commit:     Jillian Tullo <jtullo@redhat.com>
CommitDate: Fri Nov 10 11:14:47 2017 -0500

    Gracefully fail on resource create
    
    When creating a new object, validate the type if the type is specified to ensure it is a descendant of the specified resource class, similarly to what is done for other collections such as authentications.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1510215

 app/controllers/api/base_controller/generic.rb |  7 +++++++
 spec/requests/orchestration_template_spec.rb   | 15 +++++++++++++++
 2 files changed, 22 insertions(+)


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