fileconveyor icon indicating copy to clipboard operation
fileconveyor copied to clipboard

SFTPStorage broken since conversion to django-storages

Open AlimoRabbani opened this issue 11 years ago • 8 comments

I get this error when I run arbitrary.py:

Traceback (most recent call last):
  File "arbitrator.py", line 1185, in <module>
    run_file_conveyor()
  File "arbitrator.py", line 1168, in run_file_conveyor
    arbitrator = Arbitrator(os.path.join(FILE_CONVEYOR_PATH, "config.xml"), restart)
  File "arbitrator.py", line 151, in __init__
    transporter = self.__create_transporter(server)
  File "arbitrator.py", line 928, in __create_transporter
    transporter = transporter_class(settings, self.transporter_callback, self.transporter_error_callback, "Arbitrator")
  File "/home/alimohammad/fileconveyor/src/fileconveyor/fileconveyor/transporters/transporter_sftp.py", line 35, in __init__
    self.storage = SFTPStorage(location, self.settings["url"], key)
TypeError: __init__() takes exactly 1 argument (4 given)

I am on ubuntu 12.04, with python 2.7.3, django 1.5.1, paramiko 1.7.6, and django-storages 1.1.5.

I have tried it with different versions of django and django-storages and I still get the same result.

AlimoRabbani avatar Apr 16 '13 17:04 AlimoRabbani

I'm having the same issue. CentOS 6.0. Python 2.6.

karschsp avatar Apr 16 '13 19:04 karschsp

My best guess is that the Paramiko API has changed :( SFTPStorage was introduced 2 years ago, at #57, so it seems plausible.

wimleers avatar Apr 29 '13 10:04 wimleers

I think the issue maybe that on line 35: self.storage = SFTPStorage(location, self.settings["url"], key) SFTP in django-storages doesn't have an init() that supports passing params, rather it uses django conf settings (ref: http://pydoc.net/Python/django-storages/1.1.5/storages.backends.sftpstorage/ )

Note: some of the params needed for fileconveyor would need to be set with settings in SFTP_STORAGE_PARAMS which can be found in the following connect function: (ref: http://www.lag.net/paramiko/docs/paramiko.SSHClient-class.html#connect )

I believe the functionality may have broken when converting to django-storages: https://github.com/wimleers/fileconveyor/blob/master/fileconveyor/transporters/transporter_sftp.py#L35 A subclass of SFTPStorage maybe needed that can be initialized by passing params

edmooney avatar May 09 '13 17:05 edmooney

I believe the functionality may have broken when converting to django-storages: https://github.com/wimleers/fileconveyor/blob/master/fileconveyor/transporters/transporter_sftp.py#L35

I believe you're right. It seems too much code got deleted.

This could happen because so few people use this transporter. Of course that's a poor excuse. We should have test coverage for the transporters. But that of course requires a massive amount of mocking. Ah well :(

PR to fix it is welcome. If not, then I'll try to fix this soon, but I'm leaving for DrupalCon this weekend, so it won't be very soon.

wimleers avatar May 15 '13 08:05 wimleers

There's a forked version here with possible fix, need to include some notes: forked sftp

edmooney avatar May 15 '13 09:05 edmooney

Can you create a pull request to merge in your fix? :)

wimleers avatar May 15 '13 10:05 wimleers

@edmooney after adding SECRET_KEY to django_settings.py its running, however I'm now getting the following error, any ideas?

2013-05-22 21:16:38,360 - Arbitrator.Transporter - ERROR - The transporter 'SFTP' has failed while transporting the file '/var/www/html/test/hello.txt' (action: 1). Error: 'maximum recursion depth exceeded'.

wazdog avatar May 23 '13 02:05 wazdog

@wazdog.. will do pull request tomorrow with updated code.

edmooney avatar May 23 '13 02:05 edmooney