def update(self, uinfo, user, password, roles):
if roles_changed(uinfo, roles, self.database):
self.add(user, password, roles)
else:
test_client = self.get_client()
db = test_client[self.database]
try:
db.authenticate(user, password)
self.module.exit_json(changed=False, user=user)
except OperationFailure:
# If we get an operation failure, assume authentication failed, meaning we need to change the password
# This is...so not good practice, but it's a way to get idempotence from our task
self.add(user, password, roles)
bebat_mongodb_user.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录