coprhd_blockdevice.py 文件源码

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

项目:flocker-driver 作者: CoprHD 项目源码 文件源码
def authenticate_user(self):

        # we should check to see if we are already authenticated before blindly
        # doing it again
        if CoprHDCLIDriver.AUTHENTICATED is False:
            utils.COOKIE = None
            objauth = auth.Authentication(
                self.coprhdhost,
                self.port)
            cookiedir = self.cookiedir
            if( (self.coprhdcli_security_file is not '')
               and (self.coprhdcli_security_file is not None)):
                from Crypto.Cipher import ARC4
                import getpass
                objarc = ARC4.new(getpass.getuser())
                security_file = open(self.coprhdcli_security_file, 'r')
                cipher_text = security_file.readline().rstrip()
                self.username = objarc.decrypt(cipher_text)
                cipher_text = security_file.readline().rstrip()
                self.password = objarc.decrypt(cipher_text)
                security_file.close()
            objauth.authenticate_user(self.username,
                                  self.password,
                                  cookiedir,
                                  None)
            CoprHDCLIDriver.AUTHENTICATED = True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号