Bug 1394207 - create a group and specifying a role via the identifier 'id' does not work via API (WORKAROUND: use 'href' or 'name' identifiers)
Summary: create a group and specifying a role via the identifier 'id' does not work vi...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.6.0
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: GA
: cfme-future
Assignee: Tim Wade
QA Contact: Martin Kourim
URL:
Whiteboard: rest:api
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-11-11 12:00 UTC by Reartes Guillermo
Modified: 2017-12-05 15:28 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-04-07 19:50:52 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Reartes Guillermo 2016-11-11 12:00:22 UTC
Description of problem:

Creating a role specifying a role does not work when the role identifier is "id". It does work with "href" and "name".

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

How reproducible:
Always

Steps to Reproduce:

Example #1: (NOT WORKING):
----------------------


    new_group_json = {
        "action" : "create",
        "resource" : {
            "description" : NEW_GROUP,
            "role" : { "id" : result_role_id }
            }
        }


INFO: Role "1000000000018" exists.
INFO: Group name "ccc4" will be created.

G:     ccc4
R: ID: 1000000000018
R: HR: https://cfme1.example.com/api/roles/1000000000018
R:  N: aaa

ERROR: bad_request [ApiController::BadRequestError]
ERROR: Missing Role identifier href, id or name

{u'error': {u'kind': u'bad_request',
            u'klass': u'ApiController::BadRequestError',
            u'message': u'Missing Role identifier href, id or name'}}

{'action': 'create',
 'resource': {'description': 'ccc4', 'role': {'id': '1000000000018'}}}


Actual results:
One must specify the role via 'href' or 'name' and not by 'id'.

Expected results:
It should work.


Additional info:


Example #2: (WORKING):
----------------------

    new_group_json = {
        "action" : "create",
        "resource" : {
            "description" : NEW_GROUP,
            "role" : { "name" : result_role_name }
            }
        }

INFO: Role "1000000000018" exists.
INFO: Group name "ccc2" will be created.

G:     ccc2
R: ID: 1000000000018
R: HR: https://cfme1.example.com/api/roles/1000000000018
R:  N: aaa

INFO: GROUP was created.



Example #3: (WORKING):
----------------------

    new_group_json = {
        "action" : "create",
        "resource" : {
            "description" : NEW_GROUP,
            "role" : { "href" : result_role_href }
            }
        }

INFO: Role "1000000000018" exists.
INFO: Group name "ccc3" will be created.

G:     ccc3
R: ID: 1000000000018
R: HR: https://cfme1.example.com/api/roles/1000000000018
R:  N: aaa

INFO: GROUP was created.



Logs (evm.log):
---------------

[----] E, [2016-11-11T08:53:42.996605 #3031:e54db8] ERROR -- : <API> MIQ(ApiController.api_error) API Error
[----] E, [2016-11-11T08:53:42.996779 #3031:e54db8] ERROR -- : <API> MIQ(ApiController.api_error) ApiController::BadRequestError: Missing Role identifier href, id or name


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