You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ff/ssh.py

14 lines
691 B
Python

from fabric import Connection
from util import find_data_file
from util import setup_child
from util import fprint
def sftp_send_data(res, config, filename):
setup_child()
fprint("Connecting over SSH to " + config['sftp']['host'])
c = Connection(host=config['sftp']['host'], user=config['sftp']['user'], port=config['sftp']['port'], connect_kwargs={"key_filename": find_data_file(config['sftp']['keyfile']),})
fprint("Sending data over SFTP: " + filename)
fprint(c.put(find_data_file(filename), remote=config['sftp']['filepath']['send']))
fprint("Data sent over SFTP sucessfully")
#command = 'ls ' + config['sftp']['filepath']['send']
#fprint(c.run(command))