def receive_file(self, source, dest):
"""
Transmit a file to a remote host via SSH
We transmit the indicated file to the target location. Any errors
are simply passed along. In addition, the postgres system user is
currently assumed as the target file owner.
:param source: Name of file to send to indicated host.
:param dest: Full path on host to send file.
:raise: Exception output obtained from secure transmission, if any.
"""
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(self.instance.server.hostname, username='postgres')
sftp = client.open_sftp()
sftp.put(source, dest)
sftp.close()
client.close()
评论列表
文章目录