GithubHelp home page GithubHelp logo

Packaging for PyPi about mockssh HOT 7 OPEN

ayoshi avatar ayoshi commented on May 29, 2024
Packaging for PyPi

from mockssh.

Comments (7)

ayoshi avatar ayoshi commented on May 29, 2024 1

Thank you!

I hope it will become popular, it's already popular with me :)
On Aug 5, 2014 7:11 AM, "Nicolas Couture" [email protected] wrote:

https://pypi.python.org/pypi/MockSSH/1.3


Reply to this email directly or view it on GitHub
#2 (comment).

from mockssh.

ncouture avatar ncouture commented on May 29, 2024

This is not really production quality software, there are no unit tests and it has mostly been a toy project for me to play around and tests different ways to emulate SSH and commands so far.

What would be the advantage of having it in pypi?

from mockssh.

ayoshi avatar ayoshi commented on May 29, 2024

Well, I think having a way to mock SSH is helpful in building software for devops, mostly collection of data using ssh. It could, of course be mocked bypassing SSH entirely, but having a way to do it fast and from the code has a lot of value. Look, for example, at what fabric had to go through:

fabric/fabric#185
fabric/fabric#275

The only other available approach is build custom servers using paramiko.

There is also a library which does similar stuff:

https://github.com/simon-engledew/sshim

But your API , IMHO, is much much better.

from mockssh.

ncouture avatar ncouture commented on May 29, 2024

Testing SSH seems to be a problem shared by the unit tests of a set of networking libraries.

Looking at the referenced fabric tickets (fabric/fabric#185 fabric/fabric#275) I am also in favor programmatically spawning and defining SSH servers and supported commands from the unit tests during their execution over suggested alternatives.

The related fabric tickets reveals a few features they had to implement in their solution:

  1. SSH key forwarding (ssh-agent/SSH_AUTH_SOCK related?)
  2. Using ssh_config configuration files
  3. Changing the default ssh password prompt

Are these features that would be needed in MockSSH as well?

The reason I am asking this is that I would still like to know more about your personal interest in this issue is before considering packaging something that has no unit tests.

Do you think it would be possible to implement good unit test coverage of MockSSH (sshim has unit tests)?

Currently MockSSH supports:

  • SSHCommand (outputs text via SSH when typing command name)
  • PasswordPromptingCommand
  • ArgumentValidatingCommand

Before packaging MockSSH I would like to:

  • Rename PasswordPromptingCommand to PromptingCommand and make it more liberal to provide least-specific functionality
  • Remove SSHCommand from all and rename as _SSHCommand)
  • Rename ArgumentValidatingCommand as SSHCommand (all commands can and should be validating arguments, and be considered "validly typed" if their arguments are expected to be none)
  • Update examples/mock_cisco.py and examples/mock_F5.py

Where are fabric's current ssh unit tests so we can have a look at what their current solution looks like?

self ~ $ git clone http://github.com/fabric/fabric
Cloning into 'fabric'...
remote: Reusing existing pack: 15313, done.
remote: Total 15313 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (15313/15313), 7.03 MiB | 697.00 KiB/s, done.
Resolving deltas: 100% (8854/8854), done.
Checking connectivity... done.
self ~ $ grep -lir 'import ssh|from ssh|paramiko' fabric/
self ~ $ 

Thanks for pointing to https://github.com/simon-engledew/sshim, it's interesting to compare projects with common goals.

from mockssh.

ayoshi avatar ayoshi commented on May 29, 2024

Hi.

I'm not a contributor to fabric - so I'm not familiar with their codebase, but the mock ssh implementation is here:

cd fabric/tests
tests❯ grep -i SSH server.py                                                                                                       fabric/git/master
from fabric.network import disconnect_all, ssh
class TestServer(ssh.ServerInterface):
    Test server implementing the 'ssh' lib's server interface parent class.
    Mostly just handles the bare minimum necessary to handle SSH-level things
    ``serve_responses`` function and its ``SSHHandler`` class.
            return ssh.OPEN_SUCCEEDED
        return ssh.OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
        return ssh.AUTH_SUCCESSFUL if passed else ssh.AUTH_FAILED
        return ssh.AUTH_SUCCESSFUL if self.pubkeys else ssh.AUTH_FAILED

As to my personal interest - I require only the ability to fire up an instance, pass it to paramiko, and define output as per input. Personally, for me what you already have would suffice fully.

Hopefully, your project would be useful to more people though - I see someone from Rackspace starring it, so maybe they've looked for something similar.

from mockssh.

ncouture avatar ncouture commented on May 29, 2024

Created:

  • Rename PasswordPromptingCommand to PromptingCommand #3
  • Rename ArgumentValidatingCommand as SSHCommand #4
  • Implement unit tests #5

It's Friday night and I'm using Emoji on github 😿

from mockssh.

ncouture avatar ncouture commented on May 29, 2024

https://pypi.python.org/pypi/MockSSH/1.3

from mockssh.

Related Issues (17)

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.