[paramiko] putting ssh.connect in a loop

Ezra Taylor ezra.taylor at gmail.com
Mon Nov 23 20:40:50 PST 2009


All:
          I'm trying to do the following.  Why doesn't this work?


HOSTS=['bluehost', 'redhost', 'greenhost', 'yellowhost']

for i in HOSTS:

        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect("%s" %(i),username='root',password='imgoingblind')
        stdin, stdout, stderr = ssh.exec_command("uptime")
        stdout.readlines()
-- 
Ezra Taylor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lag.net/pipermail/paramiko/attachments/20091123/d8f81c36/attachment.html>


More information about the paramiko mailing list