简体   繁体   English

libcloud FileDeployment SSHClient._transport为NoneType

[英]libcloud FileDeployment SSHClient._transport is NoneType

>>>dns_node = [i for i in conn.list_nodes() if i.uuid == 'xxxxxxxxxxxxxxxxxxxxxxx07xxxxxxxxxx']
>>>try_script = 'path/to/somefile.py'
>>>dns_file = FileDeployment(try_script, target='/home/ec2-user')
>>>ssh_client = SSHClient(dns_node[0].public_ip[0], username='ec2-user',  key=os.path.expanduser("~/.ssh/id_rsa"))
>>>dns_file.run(dns_node, ssh_client)

I've verified that each of these variables assigned show me what I understand to be of the appropriate type. 我已经验证了分配给这些变量的每个变量都向我展示了我所理解的适当类型的变量。 When I try this, I get the following: 当我尝试这个时,我得到以下信息:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/libcloud/compute/deployment.py", line 111, in run contents=content) File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/libcloud/compute/ssh.py", line 174, in put sftp = self.client.open_sftp() File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/paramiko/client.py", line 414, in open_sftp return self._transport.open_sftp_client() AttributeError: 'NoneType' object has no attribute 'open_sftp_client'

This is what I have for the above objects: 这就是我对以上对象的看法:

dns_node: dns_node:

`[<Node: uuid=xxxxxxxxxxxxxxxxxxxxxxx, name=ec2_node1, state=0, public_ips=['xx.xxx.xxx.xx'], provider=Amazon EC2 ...>]`

dns_file: dns_file:

<libcloud.compute.deployment.FileDeployment object at 0x10d58de50>

ssh_client: ssh_client:

`<libcloud.compute.ssh.ParamikoSSHClient object at 0x10d55e950>`

ssh_client.connect: ssh_client.connect:

<bound method ParamikoSSHClient.connect of <libcloud.compute.ssh.ParamikoSSHClient object at 0x10d55e950>>

What am I missing? 我想念什么?

Went to the paramiko level and discovered the private key file I referenced is encrypted, which was not being handled in the ssh connection being made. 进入paramiko级别,发现我引用的私钥文件已加密,正在建立的ssh连接中未处理该私钥文件。 So even though there was an SSHCLient object, it was not able to connect. 因此,即使有一个SSHCLient对象,它也无法连接。

pkey = paramiko.RSAKey.from_private_key_file(os.path.expanduser('~/.ssh/id_rsa')) Traceback (most recent call last): File "", line 1, in File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/paramiko/pkey.py", line 198, in from_private_key_file key = cls(filename=filename, password=password) File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/paramiko/rsakey.py", line 51, in init self._from_private_key_file(filename, password) File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/paramiko/rsakey.py", line 163, in _from_private_key_file data = self._read_private_key_file('RSA', filename, password) File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/paramiko/pkey.py", line 280, in _read_private_key_file data = self._read_private_key(tag, f, password) File "/Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/paramiko/pkey.py", line 323, in _read_private_key raise PasswordRequiredException('Private key file is encrypted') paramiko.PasswordR pkey = paramiko.RSAKey.from_private_key_file(os.path.expanduser('〜/ .ssh / id_rsa'))追溯(最近一次调用):文件“”,文件“ / Users / ec2-user / Envs中的第1行” /libcloud/lib/python2.7/site-packages/paramiko/pkey.py“,行198,位于from_private_key_file中key = cls(filename = filename,password = password)文件” / Users / ec2-user / Envs / libcloud / lib / python2.7 / site-packages / paramiko / rsakey.py“,第51行, init self._from_private_key_file(文件名,密码)文件” /Users/ec2-user/Envs/libcloud/lib/python2.7/site -packages / paramiko / rsakey.py“,第163行,位于_from_private_key_file数据= self._read_private_key_file('RSA',文件名,密码)文件” /Users/ec2-user/Envs/libcloud/lib/python2.7/site- _read_private_key_file数据中的packages / paramiko / pkey.py“行280 = self._read_private_key(tag,f,password)文件” /Users/ec2-user/Envs/libcloud/lib/python2.7/site-packages/paramiko /pkey.py“,第323行,在_read_private_key中,引发PasswordRequiredException(“私有密钥文件已加密”)paramiko.PasswordR equiredException: Private key file is encrypted equiredException:私钥文件已加密

I specified a password-less key and the connection went through. 我指定了一个无密码密钥,并且连接成功。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM