Jump to: navigation, search

Difference between revisions of "Satori/SSHModuleProposal"

m (link to paramiko.SSHClient)
m (class interpreter style)
Line 5: Line 5:
  
 
==== Desired Interface ====
 
==== Desired Interface ====
  from satori.common.ssh import SSH
+
  >>> from satori.common.ssh import SSH
  client = SSH(host="123.456.789.11", host_password="pa$$word", host_username="Tobias")
+
  >>> client = SSH(host="123.456.789.11", host_password="pa$$word", host_username="Tobias")
  output = client.remote_execute("sudo echo hello", with_exit_code=True)
+
  >>> output = client.remote_execute("sudo echo hello", with_exit_code=True)
  print output
+
  >>> print output
 
     {'stdout': 'hello', 'stderr': '', 'exit_code': 0}
 
     {'stdout': 'hello', 'stderr': '', 'exit_code': 0}
 
  
 
==== Requirements ====
 
==== Requirements ====

Revision as of 17:12, 7 March 2014

SSH Module Proposal

As an initial platform to enable data plane discovery, implement an SSH module using paramiko by extending its SSHClient class.


Desired Interface

>>> from satori.common.ssh import SSH
>>> client = SSH(host="123.456.789.11", host_password="pa$$word", host_username="Tobias")
>>> output = client.remote_execute("sudo echo hello", with_exit_code=True)
>>> print output
    {'stdout': 'hello', 'stderr': , 'exit_code': 0}

Requirements

  • Manage authentication mechanisms, retry authenticating, and prefer SSH keys.
  • Mange connecting and disconnecting when remote_execute is called. (Lazy load the auth object)
  • Support ssh proxy connections [1], and create an implementation that provides the same behavior whether connecting through a proxy or connecting to the remote host directly.
  • Implement an instance property, "platform_info", that will return the remote host's platform info using (python >=2.4)'s platform module
    • architecture, distro, version
    • e.g. Ubuntu 12.04 x86_64 would return
      • {'arch': 'x86_64', 'dist': 'ubuntu', 'version': '12.04'}


[1]

  1. 1.0 1.1 github.com/paramiko/paramiko See `sock` keyword argument.