|
|
|
@ -3,16 +3,18 @@ from fabric import Connection
|
|
|
|
|
from util import find_data_file
|
|
|
|
|
from util import setup_child
|
|
|
|
|
from util import fprint
|
|
|
|
|
from util import macos
|
|
|
|
|
from invoke import exceptions
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
def sftp_send_data(config, filename, filetype):
|
|
|
|
|
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'][filetype]))
|
|
|
|
|
fprint("Data sent over SFTP successfully")
|
|
|
|
|
if not macos:
|
|
|
|
|
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'][filetype]))
|
|
|
|
|
fprint("Data sent over SFTP successfully")
|
|
|
|
|
#command = 'ls ' + config['sftp']['filepath'][filetype]
|
|
|
|
|
#fprint(c.run(command))
|
|
|
|
|
|
|
|
|
|