Skip to content

[ADD] connector_sftp: SFTP connections for Odoo - #985

Closed
lasley wants to merge 2 commits into
OCA:10.0from
LasLabs:release/10.0/SD-2358-sftp_connector
Closed

lasley wants to merge 2 commits into
OCA:10.0from
LasLabs:release/10.0/SD-2358-sftp_connector

Conversation

@lasley

@lasley lasley commented Sep 15, 2017

Copy link
Copy Markdown
Contributor

Bringing this one over from LasLabs/odoo-base/connector_sftp for the V10 migration

SFTP Connector

This module allows you to connect & interact with remote SFTP hosts.

This module does not provide functionality on its own, it is meant to provide
an abstract SFTP core to be utilized by other business logic.

Installation

To install this module, you need to:

  • Install paramiko
    pip install paramiko

Configuration

SFTP Connectors are configured at the company level, and are available in the
res.company form inside of the SFTP Connectors page.

Usage

Read Remote File

# sftp is a ``connector.sftp`` singleton.
with sftp.open('path/to/remote/file') as file_handler:
    data = file_handler.read()

Write Remote File

# sftp is a ``connector.sftp`` singleton.
with sftp.open('path/to/remote/file', 'w') as file_handler:
    file_handler.write('Some data')

@lasley lasley added this to the 10.0 milestone Sep 15, 2017
@lasley
lasley force-pushed the release/10.0/SD-2358-sftp_connector branch 12 times, most recently from 7a85635 to 6d08d5d Compare September 15, 2017 20:26
@bealdav

bealdav commented Sep 17, 2017

Copy link
Copy Markdown
Member

Hi @lasley
Thanks for your work but have you seen this module https://github.com/OCA/server-tools/tree/9.0/external_file_location ?

It seems features are close but external_file_location seems more generic.

Not sure it's a good thing to duplicate effort ?

porting is there #926

ping @florian-dacosta

@lasley

lasley commented Sep 18, 2017

Copy link
Copy Markdown
Contributor Author

Hi @bealdav - I did see that one, albeit after I submitted this one.

While external_file_location does provide a nice Interface/Adapter mechanism and does already include SFTP, I feel it is significantly more than what I need in my use case. It also doesn't do nearly enough, or I just don't understand how to use it well enough.

In my case, I do not have a cron. I require direct programmatic access to a server, with actions being triggered based on specific events. I also need knowledge of the remote directory hierarchy in a few instances.

@lasley

lasley commented Sep 18, 2017

Copy link
Copy Markdown
Contributor Author

Oh and TBH the real kicker for me is that I require LGPL. I can't use AGPL in this instance, because I am not releasing the proprietary business logic that the module is used for.

@bealdav

bealdav commented Sep 18, 2017

Copy link
Copy Markdown
Member

Thanks for your contribution.

If you think there is too much features in external_file_location it make sense to extract logic (FTP, SFTP and local filestore) with unified api their model data no other features in a separate module. Then external_file_location could depends on it in v10

So you could have the better of the 2 world: low level module but with different solutions (polymorphic) to connect by reusing existing approved modules

Otherwise it'll duplicate contributions on the same topic : which make difficult for users to choose modules.

Concerning license then you could choose LGPL if you want

But if you have a specific needs, may be it must not be put in oca.

I don't want block any contributions, but this ask questions.

my 2 cents

@lasley

lasley commented Sep 18, 2017

Copy link
Copy Markdown
Contributor Author

@bealdav - I agree we should use a unified model interface. I will submit a base module to do this within the next day or two.

I think our two implementations can complement each other though. One major difference between our two implementations is that you are using PyFilesystem2, but I am using direct Paramiko. I'll look into additional overhead, but I think I would prefer to keep with just Paramiko instead. I think a lot of other developers would make this choice, and I think we should leave them free to do so.

@bealdav

bealdav commented Sep 18, 2017

Copy link
Copy Markdown
Member

Nice, thanks a lot

@yajo

yajo commented Sep 19, 2017

Copy link
Copy Markdown
Member

Dumb question: can't you mount an sftp volume in the host via gvfs, sshfs or whatever, and forget about adding this to Odoo?

@lasley

lasley commented Sep 19, 2017

Copy link
Copy Markdown
Contributor Author

Mounting as a file system means that the module I create to interact with that file system is going to be very specific to the way I setup the servers, with authentication bound to the server itself. I don't think this is really scaleable when the EDI connections start getting numerous.

A bit about my use case - we're setting up EDI with a distributed set of partners. Specific files need to be delivered via specific pathways based on specific actions. Sometimes they also need to be received, such as in the instance of an RFQ EDI process that receives responses. Sort of like a mini-MFT platform with built-in workflows basically.

Another interesting thing about adding a base implementation for remote file system interaction-
systems that are not compatible with FUSE would also be supported. An example would be the Red October connector, which uses a strategy interestingly similar to the external_file_location module.

@lasley

lasley commented Sep 19, 2017

Copy link
Copy Markdown
Contributor Author

External system interface/adapter submitted in #993

@lasley
lasley force-pushed the release/10.0/SD-2358-sftp_connector branch 3 times, most recently from e677e4b to 001ca1a Compare September 29, 2017 18:16
@lasley
lasley force-pushed the release/10.0/SD-2358-sftp_connector branch from 001ca1a to 516f39e Compare September 29, 2017 21:12
@lasley
lasley force-pushed the release/10.0/SD-2358-sftp_connector branch 2 times, most recently from 3f6978d to 861dc03 Compare October 3, 2017 23:46
@lasley
lasley force-pushed the release/10.0/SD-2358-sftp_connector branch from 48f1c13 to 50521d5 Compare November 17, 2017 21:53
@lasley
lasley force-pushed the release/10.0/SD-2358-sftp_connector branch from 50521d5 to 2f8e4cb Compare May 19, 2019 18:36
@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Oct 23, 2022
@github-actions github-actions Bot closed this Nov 27, 2022
SiesslPhillip pushed a commit to grueneerde/OCA-server-tools that referenced this pull request Nov 20, 2024
Syncing from upstream OCA/server-tools (14.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement needs review stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants