syspanel can't update User,Tenant

Bug #912143 reported by Tiantian Gao
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Tihomir Trifonov

Bug Description

In the syspanel ,when edit user or tenant ,it returns "item not found"

Devin Carlen (devcamcar)
Changed in horizon:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Gabriel Hurley (gabriel-hurley)
milestone: none → essex-3
Revision history for this message
Devin Carlen (devcamcar) wrote :

We looked at this issue but are currently unable to reproduce it. Are you still seeing this problem? If so can you please provide more detailed information about how to reproduce the issue?

Changed in horizon:
milestone: essex-3 → none
importance: High → Undecided
assignee: Gabriel Hurley (gabriel-hurley) → nobody
status: Confirmed → Incomplete
Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

Hello,

I've added this as a comment to another bug, but now I've found that is reported as a bug itself.

QUOTE:
There is something strange here. I am using devstack setup, and for me the 'update_email' function is not working.

    def update_email(self, user, email):
        """
        Update email
        """
        # FIXME(ja): why do we have to send id in params and url?
        params = {"user": {"id": base.getid(user),
                           "email": email}}

        return self._update("/users/%s" % base.getid(user), params, "user")

This is the function in python-keystoneclient, where self._update is :

    def _update(self, url, body, response_key=None):
        resp, body = self.api.put(url, body=body)
        # PUT requests may not return a body
        if body:
            return self.resource_class(self, body[response_key])

an actual *PUT* request.

But, as I see in keystone/keystone/contrib/extensions/admin/osksadm/__init__.py

        mapper.connect("/users/{user_id}",
                    controller=user_controller,
                    action="update_user",
                    conditions=dict(method=["POST"]))
        mapper.connect("/users/{user_id}",

This supports only POST and not PUT.

Revision history for this message
Tiantian Gao (gtt116) wrote : Re: [Bug 912143] Re: syspanel can't update User,Tenant

Hello,
 I found the same things . And I think the main bug is belongs to python-keystoneclient. So I modified the python-keystoneclient code to match the Keystone's service. But python-keystoneclient seems doesn't belongs to keystone or horizon,this is a problem.

2012-02-01

gtt116

发件人:Tihomir Trifonov
发送时间:2012-02-01 05:10:47
收件人:gtt116
抄送:
主题:[Bug 912143] Re: syspanel can't update User,Tenant

Hello,
I've added this as a comment to another bug, but now I've found that is
reported as a bug itself.
QUOTE:
There is something strange here. I am using devstack setup, and for me the 'update_email' function is not working.
    def update_email(self, user, email):
        """
        Update email
        """
        # FIXME(ja): why do we have to send id in params and url?
        params = {"user": {"id": base.getid(user),
                           "email": email}}
        return self._update("/users/%s" % base.getid(user), params,
"user")
This is the function in python-keystoneclient, where self._update is :
    def _update(self, url, body, response_key=None):
        resp, body = self.api.put(url, body=body)
        # PUT requests may not return a body
        if body:
            return self.resource_class(self, body[response_key])
an actual *PUT* request.
But, as I see in
keystone/keystone/contrib/extensions/admin/osksadm/__init__.py
        mapper.connect("/users/{user_id}",
                    controller=user_controller,
                    action="update_user",
                    conditions=dict(method=["POST"]))
        mapper.connect("/users/{user_id}",
This supports only POST and not PUT.
--
You received this bug notification because you are subscribed to the bug
report.
https://bugs.launchpad.net/bugs/912143
Title:
  syspanel can't update User,Tenant
Status in OpenStack Dashboard (Horizon):
  Incomplete
Bug description:
  In the syspanel ,when edit user or tenant ,it returns "item not found"
To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/912143/+subscriptions
.

Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

In addition to the 'update_user_email' bug - probably the conditions in oksadmin:

mapper.connect("/users/{user_id}",
                    controller=user_controller,
                    action="update_user",
                    conditions=dict(method=["POST"]))

should be "PUT", but this doesn't solve the problem yet. 'Update user' expects username, so it needs further improvement in novaclient/keystone/users:UserManager:

class UserManager(base.ManagerWithFind):
...
def update_email(self, user, username, email):

and in Horizon/api/keystone.py:

def user_update_email(request, user_id, username, email):
    return User(keystoneclient(request).users.update_email(user_id, username, email))

because of keystone/logic/service.py:

class IdentityService(object):
....
   @admin_token_validator
    def update_user(self, admin_token, user_id, user):
 ...
        utils.check_empty_string(user.name,
                "Expecting a unique username")

Revision history for this message
Tihomir Trifonov (ttrifonov) wrote :

And the tenant problem is revealed:

mapper url is :

        mapper.connect("/users/{user_id}/OS-KSADM/tenant",
                    controller=user_controller,
                    action="update_user_tenant",
                    conditions=dict(method=["PUT"]))

while call is performed using

        return self._update("/users/%s/tenant" % base.getid(user),
                            params, "user")

An "OS-KSADM" is missing from URL.

Changed in horizon:
assignee: nobody → Tihomir Trifonov (ttrifonov)
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/4134

Changed in horizon:
status: Incomplete → In Progress
Devin Carlen (devcamcar)
Changed in horizon:
importance: Undecided → Medium
milestone: none → essex-4
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

Reviewed: https://review.openstack.org/4223
Committed: http://github.com/openstack/horizon/commit/d2df3ee6ed46b4934fa1a414e4bf16d74ae22ffc
Submitter: Jenkins
Branch: master

commit d2df3ee6ed46b4934fa1a414e4bf16d74ae22ffc
Author: Gabriel Hurley <email address hidden>
Date: Wed Feb 15 15:43:19 2012 -0800

    Keystone-related improvements.

      * Repairs updating for users and tenants. Fixes bug 912143.

      * Makes connection caching work for admin keystoneclient calls.
        Adds unit tests for horizon.api.keystone.keystoneclient.
        Fixes bug 933170.

      * In conjunction with this keystoneclient review
        https://review.openstack.org/#change,4133
        it takes care of the following bugs as well:

        Fixes bug 922394. Fixes bug 881606. Fixes bug 918997.

    Change-Id: Id72c99772cd214c33fd1aacf357176cf67c6f473

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: essex-4 → 2012.1
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.