Bug 1659602 - Default dialog values not populated when API auth type is auth token
Summary: Default dialog values not populated when API auth type is auth token
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.9.5
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: GA
: 5.10.0
Assignee: Gregg Tanzillo
QA Contact: Parthvi Vala
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks: 1660237
TreeView+ depends on / blocked
 
Reported: 2018-12-14 18:56 UTC by Saif Ali
Modified: 2022-03-13 16:31 UTC (History)
7 users (show)

Fixed In Version: 5.10.0.30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1660237 (view as bug list)
Environment:
Last Closed: 2019-02-12 16:49:27 UTC
Category: ---
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Saif Ali 2018-12-14 18:56:40 UTC
Description of problem:
When the advanced setting run_automate_methods_on_service_api_submit is set to true and a user requests a service via the API. Default values for a service dialog are not loaded. 

When run_automate_methods_on_service_api_submit is set to true, an API request is sent to order a service catalog with an authentication type of token, and a service service has a dropdown(required, readonly in the case) with a default value.


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

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 5 Tina Fitzgerald 2018-12-14 19:45:51 UTC
Could you ask the customer to supply:

1. The API request with the URL, body, and headers.
2. A simple reproducer dialog. (possibly a single dynamic drop down, required, read-only)

Comment 8 Tina Fitzgerald 2018-12-14 23:17:49 UTC
We understand this is a high impact issue, and have made code changes to address the issue.
The UI change requires additional testing and we expect to have something ready on Monday.

Comment 9 Gregg Tanzillo 2018-12-17 19:14:48 UTC
https://github.com/ManageIQ/manageiq-api/pull/529

Comment 11 CFME Bot 2018-12-18 14:02:45 UTC
New commit detected on ManageIQ/manageiq-api/hammer:

https://github.com/ManageIQ/manageiq-api/commit/ff8bf190492d687c9ceadacac3c3eed7b73e4ec8
commit ff8bf190492d687c9ceadacac3c3eed7b73e4ec8
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Mon Dec 17 13:23:05 2018 -0500
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Mon Dec 17 13:23:05 2018 -0500

    Merge pull request #529 from abellotti/service_template_ui_token_fix

    Updated service template's ui token info check to use token metadata for requester_type

    (cherry picked from commit cfcb10b912d5a8b2b01f96e956d3d790ce5a1818)

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

 app/controllers/api/auth_controller.rb | 3 +-
 app/controllers/api/mixins/service_templates.rb | 12 +-
 lib/services/api/user_token_service.rb | 4 +-
 spec/requests/service_templates_spec.rb | 21 +
 4 files changed, 31 insertions(+), 9 deletions(-)

Comment 12 Parthvi Vala 2019-01-02 07:51:14 UTC
FIXED. Verified on 5.10.0.30.20181218191323_900a416.

Steps taken to verify the BZ:
1) Get the authentication token by sending a request to GET /api/auth.
2) Create a new domain, `domain_1`.
3) Create a Method, let's say `method_1`.
4) Create an instance, let's say `instance_1`.
5) Create a Dialog with one static element(name="static", value_type="Integer", read_only=True, required=True) with some default value, and one dynamic element(name="dynamic", value_type="Integer", read_only=True, required=True) with the endpoint pointing to `method_1` which returns default value.
6) Create a Catalog, say `catalog_1`.
7) Create a Generic Catalog item under the newly create Catalog, say `catalog_item_1`.
8) Get the `service_catalog` id and `service_template` id.
9) Send the request.

Method used: https://bugzilla.redhat.com/attachment.cgi?id=1498504

This method sets value 2 for static element and 7 for dynamic element, both of which are reflected in the response.

Request: curl "https://<ip_address>/api/service_catalogs/:id/service_templates/:id" -k -X POST -H "Content-Type" -d '{"action" : "order"}' -H "X-Auth-Token: 5ff6a287a928d1227ba970baca20aade" -H "X-MIQ-Group: EvmGroup-super_administrator"

Response: 
{
    "href": "https://<ip_address>/api/service_requests/3",
    "id": "3",
    "description": "Provisioning Service [catalog_1] from [catalog_1]",
    "approval_state": "pending_approval",
    "type": "ServiceTemplateProvisionRequest",
    "created_on": "2019-01-02T07:39:57Z",
    "updated_on": "2019-01-02T07:39:57Z",
    "fulfilled_on": null,
    "requester_id": "1",
    "requester_name": "Administrator",
    "request_type": "clone_to_service",
    "request_state": "pending",
    "message": "Service_Template_Provisioning - Request Created",
    "status": "Ok",
    "options": {
        "dialog": {
            "dialog_static": 2,
            "dialog_dynamic": 7
        },
        "workflow_settings": {
            "resource_action_id": "34",
            "dialog_id": "3"
        },
        "initiator": null,
        "src_id": "5",
        "request_options": {
            "submit_workflow": true,
            "init_defaults": true
        },
        "cart_state": "ordered",
        "requester_group": "EvmGroup-super_administrator"
    },
    "userid": "admin",
    "source_id": "5",
    "source_type": "ServiceTemplate",
    "destination_id": null,
    "destination_type": null,
    "tenant_id": "1",
    "service_order_id": "3",
    "process": true,
    "cancelation_status": null,
    "service_templates": {
        "count": 0,
        "resources": [],
        "actions": [...]
    }
}


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