Reason shows None in error dialog in horizon

Bug #2037320 reported by Takamasa Takenaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
Takamasa Takenaka

Bug Description

Brief Description
-----------------
When reader user tries to modify system inventry configuration,
it shows
-------------------------------------------------
Error: Unable to modify host "controller-0". None
-------------------------------------------------
It should show reason/action after error message but not "None"
(Error message itself is correct as reader user
does not have a permission to modify configuration)

Severity
--------
<Minor: System/Feature is usable with minor issue>

Steps to Reproduce
------------------
Create reader role user and try to modify system configuration.

Expected Behavior
------------------
Reason/action should be shown in error dialog.

Actual Behavior
----------------
"None" is shown.

Reproducibility
---------------
100% reproducible

System Configuration
--------------------
Any

Branch/Pull Time/Commit
-----------------------
master
N/A

Timestamp/Logs
--------------
N/A

Test Activity
-------------
Feature Testing

Workaround
----------
No work around

Changed in starlingx:
status: New → In Progress
Changed in starlingx:
assignee: nobody → Takamasa Takenaka (ttakenak)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config (master)

Reviewed: https://review.opendev.org/c/starlingx/config/+/896300
Committed: https://opendev.org/starlingx/config/commit/6fd1a4902cb8510de0145bb1b5d173ff10ebb18f
Submitter: "Zuul (22348)"
Branch: master

commit 6fd1a4902cb8510de0145bb1b5d173ff10ebb18f
Author: Takamasa Takenaka <email address hidden>
Date: Fri Sep 22 17:56:26 2023 -0300

    Add reason messsage for HTTPForbidden

    Currently there is no message for HTTPForbidden.
    When user operate from horizon, access control is
    properly working but there is no message for the
    reason in error dialog.

    For example:
    Error: Unable to modify host "controller-1". None
    (Reason/Action message is expected but it shows "None")

    When a message in HTTPForbidden is extracted, cgts-client
    needs to look into "description" as the message in
    HTTPForbidden is:
    {"error_message": "{"code": 403, "title": "Forbidden",
    "description": "error message"}"}

    Closes-bug: 2037320

    Test Plan:
    PASS: Fresh install successfully(SX/DC)
    PASS: Login with reader role, modify configuration
          for inventory and show the error dialog with
          reason: "Not allowed/Role admin is needed"
    PASS: Login with admin role, modify configuration
          for inventory and no error dialog related
          access control is shown

    Change-Id: I4d0e2c2db5a12240145aef432c7d8ecf53a60204
    Signed-off-by: Takamasa Takenaka <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
Ghada Khalil (gkhalil)
Changed in starlingx:
importance: Undecided → Low
tags: added: stx.9.0 stx.config
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.opendev.org/c/starlingx/config/+/900945
Committed: https://opendev.org/starlingx/config/commit/56a6555315fa8da86f469b18ee83eea7c5e6ca84
Submitter: "Zuul (22348)"
Branch: master

commit 56a6555315fa8da86f469b18ee83eea7c5e6ca84
Author: Takamasa Takenaka <email address hidden>
Date: Tue Nov 14 18:33:35 2023 -0300

    Set default error message for for forbidden

    The issue is that some error dialog shows
    "the JSON object must be str, bytes or
    bytearray, not NoneType" when non admin user
    tries to modify configuration.

    Functional-wise it is expected behavior to
    reject configure operation because of
    forbidden. But this message is not proper
    for users.

    This happens when it extracts the error message
    from api, it is a case to be empty. The fix
    is check empty message and show the default
    message if it is empty.

    Closes-bug: 2037320

    Test Plan:
    PASS: Confirm error message dialog contains
          proper text in detail.

    Change-Id: I980df3356b60a59b19ec8b552f848e63dec3b621
    Signed-off-by: Takamasa Takenaka <email address hidden>

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.