Use openstacksdk created user, can not login.

asked 2017-12-13 04:07:37 -0500

liaodalin19903 gravatar image

updated 2017-12-13 06:49:43 -0500

My openstack version is ocata. In my computer I installed the openstacksdk (0.9.18), when I use it to create a openstack user like bellow:

# create openstack user
user_args = {
    "default_project_id":new_project.id,  # the project is created already, there I did not post here.
    "email":email,
    "is_enabled":True,
    "name":username,   # there is test10
    "pasword":password,  # there is `zxc1234`
}

try:
    new_user = super_conn.conn.identity.create_user(**user_args)
except Exception as e:
    raise e

EDIT: There I assigned the role to the user. just did not post.

try:
    role_user = super_conn.conn.identity.find_role(OPENSTACK_ROLE_USER) # there I find the role(user)
    new_project.assign_role_to_user(super_conn.conn.session, new_user, role_user)  # assign to the new user
    new_project.validate_user_has_role(super_conn.conn.session, new_user, role_user)
except Exception as e:
    raise e

I have debug the username and password in my code, my code is no mistake.

I created the new_user, and I also in openstack dashboard, checked the user and the user's project. But I can not use the username and password to login the openstack dashboard.

Whether there is something wrong with it?

the error means the credentials invalid. So, I use openstack admin user to change the created user's password, then I can login yet.

edit retag flag offensive close merge delete

Comments

My guess is that the dashboard requires the user to have a role in a project. You need a role anyway for practically all activities in an OpenStack cloud.

Bernd Bausch gravatar imageBernd Bausch ( 2017-12-13 05:50:10 -0500 )edit

@BerndBausch See my EDIT, friend.

liaodalin19903 gravatar imageliaodalin19903 ( 2017-12-13 06:50:07 -0500 )edit

typo in user_args:

"pasword":password,

should be:

"password":password, ## Missing an "s"
Eduardo Gonzalez gravatar imageEduardo Gonzalez ( 2017-12-13 09:27:53 -0500 )edit

@EduardoGonzalez Thank you , so sorry about it.

liaodalin19903 gravatar imageliaodalin19903 ( 2017-12-13 20:16:51 -0500 )edit