Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SFTPStorage broken since conversion to django-storages #142

Open
AlimoRabbani opened this issue Apr 16, 2013 · 8 comments
Open

SFTPStorage broken since conversion to django-storages #142

AlimoRabbani opened this issue Apr 16, 2013 · 8 comments

Comments

@AlimoRabbani
Copy link

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.

@karschsp
Copy link

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

@wimleers
Copy link
Owner

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

@edmooney
Copy link

edmooney commented May 9, 2013

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

@wimleers
Copy link
Owner

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.

@ghost ghost assigned wimleers May 15, 2013
@edmooney
Copy link

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

@wimleers
Copy link
Owner

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

@wazdog
Copy link

wazdog commented May 23, 2013

@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'.

@edmooney
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants