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

Packaging for PyPi #2

Open
ayoshi opened this issue Jun 18, 2014 · 7 comments
Open

Packaging for PyPi #2

ayoshi opened this issue Jun 18, 2014 · 7 comments
Assignees

Comments

@ayoshi
Copy link

ayoshi commented Jun 18, 2014

Hi.

Love the idea, could you please package it for pypi?

If you want an easy way, this tool could help:

https://github.com/Infinidat/infi.projector

@ncouture
Copy link
Owner

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?

@ayoshi
Copy link
Author

ayoshi commented Jun 19, 2014

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.

@ncouture
Copy link
Owner

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.

@ayoshi
Copy link
Author

ayoshi commented Jun 29, 2014

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.

@ncouture ncouture self-assigned this Jul 5, 2014
@ncouture ncouture added this to the Package for PyPi milestone Jul 5, 2014
@ncouture
Copy link
Owner

ncouture commented Jul 5, 2014

Created:

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

@ncouture ncouture changed the title Packaging for pypi Packaging for PyPi Jul 5, 2014
@ncouture
Copy link
Owner

ncouture commented Aug 5, 2014

@ayoshi
Copy link
Author

ayoshi commented Aug 6, 2014

Thank you!

I hope it will become popular, it's already popular with me :)
On Aug 5, 2014 7:11 AM, "Nicolas Couture" notifications@github.com wrote:

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


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

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

2 participants