[paramiko] putting ssh.connect in a loop

Eric Noulard eric.noulard at gmail.com
Tue Nov 24 00:30:29 PST 2009


2009/11/24 Ezra Taylor <ezra.taylor at gmail.com>:
> All:
>           I'm trying to do the following.  Why doesn't this work?

May be you can tell us "how" it doesn't work?
Do you manage to reach the first host?
None of them?
What kind of error do you get?

> 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
>
> _______________________________________________
> paramiko mailing list
> paramiko at lag.net
> http://www.lag.net/cgi-bin/mailman/listinfo/paramiko
>



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



More information about the paramiko mailing list