bebat_mongodb_user.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Ansible-MongoDB-Install-Role 作者: bbatsche 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号