agent_rpc.py 文件源码

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

项目:intel-manager-for-lustre 作者: intel-hpdd 项目源码 文件源码
def construct_ssh_auth_args(self, root_pw=None, pkey=None, pkey_pw=None):

        args = {}
        if root_pw:
            args.update({"password": root_pw})

        if pkey:
            try:
                #  private key to match a public key on the server
                #  optionally encrypted
                pkey_filelike = StringIO(pkey)
                if pkey_pw:
                    pkey_paramiko = paramiko.RSAKey.from_private_key(
                        pkey_filelike,
                        pkey_pw)
                else:
                    pkey_paramiko = paramiko.RSAKey.from_private_key(pkey_filelike)
                args.update({"pkey": pkey_paramiko})
            except SSHException:
                #  Invalid key, or wrong passphase to enc key
                #  pass on form of auth
                pass

        return args
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号