Coder Social home page Coder Social logo

Comments (7)

mwilliamson avatar mwilliamson commented on August 25, 2024

Hello! Thanks for the suggestion. I've never used the sock argument, but from a quick read it looks like a socket-like argument -- that is, the interface isn't really specific to paramiko, but is whatever subset of the socket interface that Paramiko uses. So, it's not entirely implausible for people to provide their own implementation.

Perhaps there's a way we can get the simplicity of option 1, to keep the interaction with Paramiko simple (and more likely to be correct), with the user-friendliness of option 3. Specifically, what about something like (naming needs more thought):

spur.SshShell(sock=spur.proxy.ssh_command(username=...))

Where spur.proxy.ssh_command(...) creates the instance of ProxyCommand that paramiko expects?

from spur.py.

lindycoder avatar lindycoder commented on August 25, 2024

Sure sounds nice... i'll change my PR to have a new sock= parameter to which you can feed anything, that would unblock me

and in a second pass the ssh_command helper could be added

from spur.py.

lindycoder avatar lindycoder commented on August 25, 2024

PR has been updated

from spur.py.

lindycoder avatar lindycoder commented on August 25, 2024

Okay here is some interesting news :

Paramiko's proxy command is NOT python 3 compatible but it's only partially part of paramiko, because as a user you could give anything that is socket like to sock=, there is an issue about that : paramiko/paramiko#673 which contains a PR with a python 3 comptable version of ProxyCommand.

So to add the proxy command building helper in spur i would need a test, that both work in py2 and py3, py2 would use the ProxyCommand (stock) and the py3 would use a copy made from the PR.

So we could venture into creating a new ProxyCommand that works for both version and include it in your package, but i fear that would include some "if py2 then... if py3 then" in the code which is not the most elegant.
Or we could push to paramiko but that looks hard, there's 65 PR open and some are a years old.

My suggestion : leave it with the sock= i already proposed and no builders, so users such as me can have their own fixed proxy command that they use in their project that may not require py2 compatibility

from spur.py.

mwilliamson avatar mwilliamson commented on August 25, 2024

I think your suggestion makes sense: trying to provide builders is probably out of the scope of this library given that Paramiko itself doesn't provide an implementation of ProxyCommand that works across Python 2 and 3. Thanks again for the pull request!

from spur.py.

lindycoder avatar lindycoder commented on August 25, 2024

Wonderful, thanks for your time, keep up the good work!

from spur.py.

mwilliamson avatar mwilliamson commented on August 25, 2024

No problem at all, thanks for the code and accommodating my requests!

from spur.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.