LibvirtClient.py 文件源码

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

项目:katprep 作者: stdevel 项目源码 文件源码
def retrieve_credentials(self, credentials, user_data):
        """
        Retrieves the libvirt credentials in a strange format and hand it to
        the API in order to communicate with the hypervisor.
        To be honest, I have no idea why this has to be done this way. I have
        taken this function from the official libvirt documentation.

        :param credentials: libvirt credentials object
        :param user_data: some data that will never be used
        :type user_data: None
        """
        #get credentials for libvirt
        for credential in credentials:
            if credential[0] == libvirt.VIR_CRED_AUTHNAME:
                credential[4] = self.USERNAME
                if len(credential[4]) == 0:
                    credential[4] = credential[3]
            elif credential[0] == libvirt.VIR_CRED_PASSPHRASE:
                credential[4] = self.PASSWORD
            else:
                return -1
        return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号