def _get_auth_conn(config):
def request_cred(credentials, user_data):
for credential in credentials:
if credential[0] == libvirt.VIR_CRED_AUTHNAME:
credential[4] = config.get("username")
elif credential[0] == libvirt.VIR_CRED_PASSPHRASE:
credential[4] = config.get("password")
return 0
auth = [
[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE],
request_cred, None
]
return libvirt.openAuth(config["uri"], auth, 0)
评论列表
文章目录