Users email can not delete by updating user

Bug #1573479 reported by Zhang Yun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Lucas H. Xu

Bug Description

Environment: Kilo build

Steps:
1) Login using admin
2) Click Identity -> Users
3) Create a user with email address input.
4) Then edit this user to let the email para as empty which want to remove original email .
5) But after this update, the email address still exist.

Expected Result: Email address should be removed by this update action

Also tried with the keystone command, it can successfully remove the email:

1. Create user with an email using Identity API v2:
# keystone --os-identity-api-version 2.0 user-create --name testv2 --email <email address hidden>
/usr/lib/python2.7/site-packages/keystoneclient/shell.py:65: DeprecationWarning: The keystone CLI is deprecated in favor of python-openstackclient. For a Python library, continue using python-keystoneclient.
  'python-keystoneclient.', DeprecationWarning)
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | <email address hidden> |
| enabled | True |
| id | 6cde253f2e4c474993d78a70e21886ab |
| name | testv2 |
| username | testv2 |
+----------+----------------------------------+

2. Update user to remove the email using Identity API v2:
# keystone --os-identity-api-version 2.0 user-update --name testv2new --email "" testv2
/usr/lib/python2.7/site-packages/keystoneclient/shell.py:65: DeprecationWarning: The keystone CLI is deprecated in favor of python-openstackclient. For a Python library, continue using python-keystoneclient.
  'python-keystoneclient.', DeprecationWarning)
User has been updated.

Then run command to verify, the email address has been removed.
# keystone --os-identity-api-version 2.0 user-get testv2new
/usr/lib/python2.7/site-packages/keystoneclient/shell.py:65: DeprecationWarning: The keystone CLI is deprecated in favor of python-openstackclient. For a Python library, continue using python-keystoneclient.
  'python-keystoneclient.', DeprecationWarning)
+----------+----------------------------------+
| Property | Value |
+----------+----------------------------------+
| email | |
| enabled | True |
| id | 6cde253f2e4c474993d78a70e21886ab |
| name | testv2new |
| username | testv2new |
+----------+----------------------------------+

Revision history for this message
Zhang Yun (zhangyun) wrote :

This issue found on icehouse and recreated on kilp, but in the current code, it appears to still be an issue.

forilen (huyulin2011)
Changed in horizon:
assignee: nobody → forilen (huyulin2011)
Revision history for this message
Zhang Yun (zhangyun) wrote :

Hi forilen, is there any clue you have found to fix it? Please guide me, thanks!

Revision history for this message
Itxaka Serrano (itxaka) wrote :

I cant reproduce this on mitaka/liberty/kilo.

- Created user test with email <email address hidden>
- Edited user and removed email

And everything went ok.

Can you provide more info on this?

Revision history for this message
Itxaka Serrano (itxaka) wrote :

BTW, tested against kilo and liberty keystone backends just in case, in both cases it worked.

Changed in horizon:
status: New → Incomplete
Revision history for this message
Zhang Yun (zhangyun) wrote :

Hi Itxaka, I definitely can create this issue on my env with identity-api-version is 2.0 (kilo release). What the identity api version are you using? V3?

I would like to paste my screen shot for you ,but I don't know how to upload. Could you please guide me?

Revision history for this message
Zhang Yun (zhangyun) wrote :

Hi Itxaka, this issue only occurred on Horizon UI, the keystone command can do this successfully.

Does you also tried it on Horizon UI? or using the keystone command?

forilen (huyulin2011)
Changed in horizon:
assignee: forilen (huyulin2011) → nobody
Zhang Yun (zhangyun)
Changed in horizon:
status: Incomplete → New
Revision history for this message
Zhang Yun (zhangyun) wrote :

I build up a Newton devstack env and retry this issue, after I update the user on horizon UI , the UI will prompts this error - "Error: Unable to update the user". So the update user on Horizon UI is definitely has problem.

Revision history for this message
Zhang Yun (zhangyun) wrote :
Revision history for this message
Zhang Yun (zhangyun) wrote :
Revision history for this message
Zhang Yun (zhangyun) wrote :
Revision history for this message
Zhang Yun (zhangyun) wrote :
Revision history for this message
Zhang Yun (zhangyun) wrote :
Revision history for this message
Itxaka Serrano (itxaka) wrote :

Indeed, Im using v3, so this may only affect v2. Let me try to set up an env with v2 and retry. Thanks!

Revision history for this message
Zhang Yun (zhangyun) wrote :

Yes, Itxaka, this issue only occur on v2. If you find any clue, please guide me here. Thanks.

Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

I've tested on v2, and unable to recreate the issue either.

Changed in horizon:
status: New → Incomplete
Revision history for this message
Zhang Yun (zhangyun) wrote :

Rob, which release you used? If possible, would you please paste some screenshot?

I also build up a Newton devstack env and retry this issue, after I update the user on horizon UI , the UI will prompts this error - "Error: Unable to update the user". So the update user on Horizon UI is definitely has problem.

Changed in horizon:
status: Incomplete → New
Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

This was on Newton. Can you update through the CLI?

Revision history for this message
Zhang Yun (zhangyun) wrote :

Yes, the CLI can work as expect, the error only occur on the Horizon UI.

On your Newton env, the CLI and UI both can work normally?

Revision history for this message
Zhang Yun (zhangyun) wrote :

I tried on the latest Newton devtack env today, the issue still exist.
On horizon UI, I can not edit the user to remove the email with V2, but the CLI can.

Revision history for this message
Zhang Yun (zhangyun) wrote :
Download full text (6.2 KiB)

I tired to modify the code of Kilo release to fix this issue as below:

Change /usr/share/openstack-dashboard/openstack_dashboard/dashboards/identity/users/forms.py

Original:
    201 try:
    202 if "email" in data:
    203 data['email'] = data['email'] or None

Modified:
    201 try:
    202 if "email" in data:
    203 data['email'] = data['email'] or ''

Then restart the httpd service. This issue has gone.

But when running the UT for this new changed file, I failed the Jenkins with py27 test. Below is my modified UT code and the prompts error:

Could some one can help me on this? It has troubled me some days. Thanks a lot!

Change /usr/share/openstack-dashboard/openstack_dashboard/dashboards/identity/users/tests.py
Original:
346 formData = {'method': 'UpdateUserForm', 347
347 'id': user.id,
348 'name': user.name,
349 'email': "",
350 'project': self.tenant.id}

Modified:
346 formData = {'method': 'UpdateUserForm', 347
347 'id': user.id,
348 'name': user.name,
349 'email': '', ---> changed here
350 'project': self.tenant.id}

The UT promots error as below:
======================================================================
FAIL: test_update_with_no_email_attribute (openstack_dashboard.dashboards.identity.users.tests.UsersViewTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jenkins/workspace/gerrit-horizon-es-py27/openstack_dashboard/test/helpers.py", line 112, in instance_stub_out
    return fn(self, *args, **kwargs)
  File "/home/jenkins/workspace/gerrit-horizon-es-py27/openstack_dashboard/dashboards/identity/users/tests.py", line 353, in test_update_with_no_email_attribute
    res = self.client.post(USER_UPDATE_URL, formData)
  File "/home/jenkins/workspace/gerrit-horizon-es-py27/.tox/py27/local/lib/python2.7/site-packages/django/test/client.py", line 482, in post
    secure=secure, **extra)
  File "/home/jenkins/workspace/gerrit-horizon-es-py27/.tox/py27/local/lib/python2.7/site-packages/django/test/client.py", line 296, in post
    secure=secure, **extra)
  File "/home/jenkins/workspace/gerrit-horizon-es-py27/.tox/py27/local/lib/python2.7/site-packages/django/test/client.py", line 358, in generic
    return self.request(**r)
  File "/home/jenkins/workspace/gerrit-horizon-es-py27/.tox/py27/local/lib/python2.7/site-packages/django/test/client.py", line 440, in request
    six.reraise(*exc_info)
  File "/home/jenkins/workspace/gerrit-horizon-es-py27/.tox/py27/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/jenkins/workspace/gerrit-horizon-es-py27/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/home/je...

Read more...

Revision history for this message
Zhang Yun (zhangyun) wrote :

Could some one can help me on this Jenkins error? It has troubled me some days. Thanks a lot!

Revision history for this message
Zhang Yun (zhangyun) wrote :

Submit one patch to fix it. https://review.openstack.org/#/c/324526/

Changed in horizon:
assignee: nobody → Zhang Yun (zhangyun)
Changed in horizon:
assignee: Zhang Yun (zhangyun) → nobody
status: New → Confirmed
tags: added: low-hanging-fruit ocata-backport-potential
Changed in horizon:
importance: Undecided → Low
milestone: none → next
Changed in horizon:
assignee: nobody → lahari (ananda-bhavaraju)
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/492286

Changed in horizon:
assignee: lahari (ananda-bhavaraju) → Lucas H. Xu (xuh-2)
status: Confirmed → In Progress
Ying Zuo (yingzuo)
Changed in horizon:
milestone: next → queens-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

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

commit a9517ff6151be22a4aa5dccd8389b358f591a92b
Author: Lucas H. Xu <email address hidden>
Date: Wed Aug 9 16:30:46 2017 -0400

    Fix cannot delete user's email addresses in the identity/user panel

    How to reproduce the bug:

    P.S. Using the horizon master(pike) codebase

    1) Login as an admin user
    2) Click Identity and go to the Users panel
    3) Create a user and put an email address with that user
    4) Then edit this user to clear the email address.
    5) Update the user and even though we have a green banner(successful)
    show up, the email address still viewable and do not disappear.

    Closes Bug: #1573479

    Change-Id: I0273d0c6d885c77f1f74bdc2ae6674d1e6539ac0

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

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/494073

Ying Zuo (yingzuo)
tags: added: pike-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/494074

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (stable/ocata)

Change abandoned by Ying Zuo (<email address hidden>) on branch: stable/ocata
Review: https://review.openstack.org/494073
Reason: too late to backport to stable/ocata

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

Reviewed: https://review.openstack.org/494074
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=3e298076985695ae370f0292c51545ac408fddb0
Submitter: Jenkins
Branch: stable/pike

commit 3e298076985695ae370f0292c51545ac408fddb0
Author: Lucas H. Xu <email address hidden>
Date: Wed Aug 9 16:30:46 2017 -0400

    Fix cannot delete user's email addresses in the identity/user panel

    How to reproduce the bug:

    P.S. Using the horizon master(pike) codebase

    1) Login as an admin user
    2) Click Identity and go to the Users panel
    3) Create a user and put an email address with that user
    4) Then edit this user to clear the email address.
    5) Update the user and even though we have a green banner(successful)
    show up, the email address still viewable and do not disappear.

    Closes Bug: #1573479

    Change-Id: I0273d0c6d885c77f1f74bdc2ae6674d1e6539ac0
    (cherry picked from commit a9517ff6151be22a4aa5dccd8389b358f591a92b)

tags: added: in-stable-pike
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 13.0.0.0b1

This issue was fixed in the openstack/horizon 13.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 12.0.1

This issue was fixed in the openstack/horizon 12.0.1 release.

Akihiro Motoki (amotoki)
tags: removed: ocata-backport-potential pike-backport-potential
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.