Skip to content

Commit

Permalink
[connections] Commented out Ssh.upload
Browse files Browse the repository at this point in the history
This method is not used yet but it will be in the future.
For the moment we can avoid adding tests for it and keep it commented out.
  • Loading branch information
nemesifier committed Apr 14, 2019
1 parent 3575048 commit 21f1f4a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions openwisp_controller/connection/connectors/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ def exec_command(self, command, timeout=SSH_COMMAND_TIMEOUT,
def update_config(self):
raise NotImplementedError()

def upload(self, fl, remote_path):
scp = SCPClient(self.shell.get_transport())
if not hasattr(fl, 'getvalue'):
fl_memory = BytesIO(fl.read())
fl.seek(0)
fl = fl_memory
scp.putfo(fl, remote_path)
scp.close()
# TODO: this method is not used yet
# but will be necessary in the future to support other OSes
# def upload(self, fl, remote_path):
# scp = SCPClient(self.shell.get_transport())
# if not hasattr(fl, 'getvalue'):
# fl_memory = BytesIO(fl.read())
# fl.seek(0)
# fl = fl_memory
# scp.putfo(fl, remote_path)
# scp.close()

0 comments on commit 21f1f4a

Please sign in to comment.