+ericli,lmr As a way to eliminate the known_hosts warning, this approach doesn't seem like a bad idea to me. At least, I like the idea better than either dropping all stderr or having to put some sort of filter on the output. Obviously someone would still need to spend the time to integrate this approach into the abstract_ssh.py code...
-- John On Fri, Jan 29, 2010 at 3:45 PM, Jongki Suwandi <[email protected]> wrote: > Here's one simple hack/workaround you could do to stop those messages > but yet still avoid the issues of having old entry in an known_hosts > file and security (ie access to the known_hosts file). Here's my > quickie script > > > #!/usr/bin/python2.4 > import os > > host = 'someremotehost' > tmpfile = os.tmpfile() > tmpfd = tmpfile.fileno() > > cmd = "/usr/bin/ssh -a -x -o StrictHostKeyChecking=no -o > UserKnownHostsFile=/dev/fd/%d -o BatchMode=yes -o ConnectTimeout=60 -o > ServerAliveInterval=300 -l root -p 22 %s 'uname -a'" % (tmpfd, host) > > for i in range(10): > os.system(cmd) > tmpfile.close() > > > The idea is to use tmpfile() which will create a temporary file, open > it, and unlink it right away so there's no directory entry at all. > Then in the ssh/scp calls use /dev/fd/<fildesc> for the reference to > the file. But you have to make sure that you keep that file open > across all the ssh/scp calls during the autoserv session. The > temporary file will be automatically deleted when you close that file > or autoserv exits/crashes. > > With the above you'll get only one warning message (at the beginning) > per remote host. > > -Jongki Suwandi > _______________________________________________ > Autotest mailing list > [email protected] > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
