inline edit failed in user table because description doesn't exists

Bug #1474228 reported by Kuo-tung Kao (jelly)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Kuo-tung Kao (jelly)
Kilo
Fix Released
Undecided
Unassigned

Bug Description

inline edit failed in user table because description doesn't exits

Environment:
ubuntu devstack stable/kilo

horizon commit id: c2b543bb8f3adb465bb7e8b3774b3dd1d5d999f6
keystone commit id: 8125a8913d233f3da0eaacd09aa8e0b794ea98cb

$keystone --version
/home/user/.virtualenvs/test-horizon/local/lib/python2.7/site-packages/keystoneclient/shell.py:64: DeprecationWarning: The keystone CLI is deprecated in favor of python-openstackclient. For a Python library, continue using python-keystoneclient.
  'python-keystoneclient.', DeprecationWarning)
1.6.0

How to reproduce the bug:

1. create a new user. (important)
2. Try to edit user using inline edit.

Note:

If you edit the user using inline edit and the user was edited by update user form ever, the exception will not raise because the update form set description to empty string.

https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/identity/users/forms.py#L195

https://github.com/openstack/horizon/blob/master/openstack_dashboard/dashboards/identity/users/forms.py#L228

Traceback:
Internal Server Error: /identity/users/
Traceback (most recent call last):
  File "/home/user/.virtualenvs/test-horizon/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/user/github/horizon/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/home/user/github/horizon/horizon/decorators.py", line 52, in dec
    return view_func(request, *args, **kwargs)
  File "/home/user/github/horizon/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/home/user/.virtualenvs/test-horizon/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/user/.virtualenvs/test-horizon/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/user/github/horizon/horizon/tables/views.py", line 224, in post
    return self.get(request, *args, **kwargs)
  File "/home/user/github/horizon/horizon/tables/views.py", line 160, in get
    handled = self.construct_tables()
  File "/home/user/github/horizon/horizon/tables/views.py", line 145, in construct_tables
    preempted = table.maybe_preempt()
  File "/home/user/github/horizon/horizon/tables/base.py", line 1533, in maybe_preempt
    new_row)
  File "/home/user/github/horizon/horizon/tables/base.py", line 1585, in inline_edit_handle
    error = exceptions.handle(request, ignore=True)
  File "/home/user/github/horizon/horizon/exceptions.py", line 361, in handle
    six.reraise(exc_type, exc_value, exc_traceback)
  File "/home/user/github/horizon/horizon/tables/base.py", line 1580, in inline_edit_handle
    cell_name)
  File "/home/user/github/horizon/horizon/tables/base.py", line 1606, in inline_update_action
    self.request, datum, obj_id, cell_name, new_cell_value)
  File "/home/user/github/horizon/horizon/tables/actions.py", line 952, in action
    self.update_cell(request, datum, obj_id, cell_name, new_cell_value)
  File "/home/user/github/horizon/openstack_dashboard/dashboards/identity/users/tables.py", line 210, in update_cell
    horizon_exceptions.handle(request, ignore=True)
  File "/home/user/github/horizon/horizon/exceptions.py", line 361, in handle
    six.reraise(exc_type, exc_value, exc_traceback)
  File "/home/user/github/horizon/openstack_dashboard/dashboards/identity/users/tables.py", line 200, in update_cell
    description=user_obj.description,
  File "/home/user/.virtualenvs/test-horizon/local/lib/python2.7/site-packages/keystoneclient/openstack/common/apiclient/base.py", line 494, in __getattr__
    raise AttributeError(k)
AttributeError: description

Changed in horizon:
assignee: nobody → jelly (coding1314)
summary: - inline edit failed in user table because description doesn't exits
+ inline edit failed in user table because description doesn't exists
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/201437

Changed in horizon:
status: New → In Progress
description: updated
description: updated
description: updated
description: updated
Revision history for this message
Kuo-tung Kao (jelly) (coding1314) wrote :

If you create a user and get the user detail,
you will get something like
{u'username': u'eee', u'id': u'92ff030739414f4eb2d06e6617cbd71e', u'enabled': True, u'name': u'eee', u'email': None}.

So User object doesn't have `description` attribute.

If the description of user is set to the value which is not null, the response is like
{u'username': u'ccc', u'name': u'ccc', u'enabled': True, u'tenantId': u'43559c44ec8c4f899f55568b1d34725e', u'email': <email address hidden>', u'id': u'a42cacdd184747b7bbdf110a48c14e54', u'description': u''}

So User object has `description` attribute.

ref:
https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/openstack/common/apiclient/base.py#L478

tags: added: kilo-backport-potential
Revision history for this message
Kuo-tung Kao (jelly) (coding1314) wrote :

I send a patch for the bug. https://review.openstack.org/#/c/201437/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/201437
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=fb2a31cff6273a767ad371c1c6893233aa1ca047
Submitter: Jenkins
Branch: master

commit fb2a31cff6273a767ad371c1c6893233aa1ca047
Author: Kuo-tung Kao <email address hidden>
Date: Tue Jul 14 14:54:43 2015 +0800

    Don't get descript if attribute doesn't exist.

    Don't get description attribute from user_obj in update_cell function
    in user table if the attribute doesn't exist.

    Closes-Bug: #1474228
    Change-Id: I38978402991121e2e2259856aa52b633a60cba36

Changed in horizon:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/215300

Thierry Carrez (ttx)
Changed in horizon:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/kilo)

Reviewed: https://review.openstack.org/215300
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=8da65b6092e7944a1d5bd6ff4a588655858de45c
Submitter: Jenkins
Branch: stable/kilo

commit 8da65b6092e7944a1d5bd6ff4a588655858de45c
Author: Kuo-tung Kao <email address hidden>
Date: Tue Jul 14 14:54:43 2015 +0800

    Don't get descript if attribute doesn't exist.

    Don't get description attribute from user_obj in update_cell function
    in user table if the attribute doesn't exist.

    Conflicts:
     openstack_dashboard/dashboards/identity/users/tables.py

    Closes-Bug: #1474228
    Change-Id: I38978402991121e2e2259856aa52b633a60cba36
    (cherry picked from commit fb2a31cff6273a767ad371c1c6893233aa1ca047)

tags: added: in-stable-kilo
Thierry Carrez (ttx)
Changed in horizon:
milestone: liberty-3 → 8.0.0
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.