Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

对接企业oauth,获取到企业内部用户后,使用sync_to_usermgr来创建蓝鲸用户,会报错 #1972

Open
dgsfor opened this issue Nov 5, 2024 · 0 comments

Comments

@dgsfor
Copy link

dgsfor commented Nov 5, 2024

在论坛上也提问了:https://bk.tencent.com/s-mart/community/question/14162?type=answer

当前我这边已经对接了企业的Oauth。
然后获取到我们内部的登录用户信息之后,想要把这个用户写入到蓝鲸用户管理里,参考了这个文档
https://bk.tencent.com/docs/markdown/ZH/UserManage/IntegrateGuide/Docking_enterprise_login_system/login_with_usermgr.md

使用方法:ok, message = user.sync_to_usermgr(),没有报错

紧接着我获取或者创建用户信息:user = UserModel.objects.create_user(username=username)
发现报错了:bk_login.bkauth_user' doesn't exist

这块我看了文档发现说是mysql数据库没有创建,我看文档介绍,只要bk-mysql部署成功,就会默认创建数据库和表:
https://bk.tencent.com/docs/markdown/ZH/DeploymentGuides/7.1/storage-services.md

实际上我去mysql里面查看,确实没有对应的表。

[root@srpx-controller ~]# kb exec -it bk-mysql-mysql-master-0 /bin/bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
I have no name!@bk-mysql-mysql-master-0:/$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 31836640
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use bk_login;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+------------------------+
| Tables_in_bk_login |
+------------------------+
| auth_group |
| auth_group_permissions |
| auth_permission |
| django_content_type |
| django_migrations |
| django_session |
| login_bklog |
| login_bktoken |
+------------------------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant