PyDSH - The Python Distributed Shell

DESCRIPTION:

  PyDSH is a simple remote administration toolkit, consisting of two tools: 
  pydsh and pydcp. The pydsh command allows you to run a command on multiple 
  hosts in parallel over RSH, SSH or Telnet, OR you can manage your SSH public 
  keys with functions to help you generate, install and revoke them.  The pydcp
  command is used for copying files to/from multiple hosts using SCP. 

STATUS:

  pydsh is functional for sending commands, and managing SSH Keys.
  pydcp supports sending and receiving files and directories (recursive).

WHY PYDSH?

Key functions of Pydsh:
1.  Allows for one command to be run on multiple hosts at once.
2.  Easy host range declarations.
3.  Easy SSH Key management on local and remote hosts.
4.  Easy file copying to and from remote hosts.
5.  Shell commands work with SSH, RSH and Telnet.
6.  Improved output layout.

HOST FILES:

Host files are stores in the /etc/pydsh/group/ directory.  The file format is a
for each host to be listed on a line by itself.  For example:

    hostA
    hostB
    hostC
    localhost

The "-a" command line option is a shortcut to the all group, this group is
created at installation with localhost defined in it.
       
PYDSH EXAMPLES:

  Run uptime on Host1 and Host2:

    pydsh -n host1 -n host2 uptime
         or
    pydsh --node=host1 --node=host2 uptime   
         or
    pydsh --node=host1-2 uptime

  Run df -h on the hosts from the default hostfile:

    pydsh -a -- df -h 
         or
    pydsh -a "df -h"

  Run uptime on hosts 192.168.0.1 to 192.168.0.254:

    pydsh -n 192.168.0.1-254 uptime

  Run uptime on hosts Node01 to Node10:
    
    pydsh -n Node01-10 uptime

  Run uptime on a host1, 192.168.0.1-100, and Node01-10:

    pydsh -n host1 -n 192.168.0.1-100 --node=Node01-10 uptime
     
  Run uptime as user other than current:
    
    pydsh --user=USER2 -n host1 uptime
    
  Run uptime as root:
   
    pydsh -s -a uptime
         or
    pydsh --sudo -a uptime

PYDCP EXAMPLES:

  Copy one file to home directory on all remote hosts:

    pydcp -a --scp_mode=send --scp_local=./filename 

  Copy one file to the /tmp/cache directory on all remote hosts:

    pydcp -a --scp_mode=send --scp_local=./filename --scp_remote=/tmp/cache/

TODO

  1.  Tool to build host group files.
      A.  Determine way for a single host to use alternate port
          configuration.
  2.  Better progress indicator when loop is running.
  3.  Self install script.
      A.  Test for deps.
  4.  deb package.
  5.  rpm package.
  6.  Add post install to rpm/deb to build ALL file.
  7.  Experimenting with compiled python scripts.  The compiled
      version is almost half the size of the source script.
      However it cannot be editted or studied as easily.

KNOWN BUGS/ISSUES

  1.  Display updates during SSH key install/revoke
  2.  Assumes that same shell (BASH or SH) is installed and 
      selected as default for connecting user accounts on all 
      nodes.
  3.  If you try to connect many times (10+) to the same host at
      the same time, it may introduce errors because SSH is 
      generally configured to only allow so many simultaneous 
      connections.  You can eliminate the errors by adjusting the 
      MaxStartups variable in /etc/ssh/sshd_config.  It may also
      be necessary to use the --timeout flag for pydsh to set a
      higher timeout time.
      -- Similar "bugs" may be introduced if you are also using 
         the -s flag with pydsh to run the command as root.
         Testing seems to work for about 10 simultaneous sessions
         on remote hosts and then reports TIMEOUTs for su logins 
         after that.
      -- Running pydsh as a single thread seems to eliminate
         both of these bugs.  The easist method to run as a single
         thread is to turn verbosity up (-vvvv) or to adjust the
         thread variables in pydshrc.
