diff options
author | Rahul C S <rahulcs@redhat.com> | 2012-02-17 17:23:28 +0530 |
---|---|---|
committer | Rahul C S <rahulcs@redhat.com> | 2012-02-17 17:24:19 +0530 |
commit | db468693ef5faa294d9bc3cd3c5d70c0d99d488b (patch) | |
tree | f552d0a8e88304dba5038eac670a5c7afe3c267e /perf-framework/pwl_ssh | |
parent | 01a77a1ae18d9add01f893e06e58191b065602e8 (diff) |
Adding the performance framework to the qa repo
Change-Id: Ia7dbd82e9bb2e5e65e9345234ce34f8518a091ad
Signed-off-by: Rahul C S <rahulcs@redhat.com>
Diffstat (limited to 'perf-framework/pwl_ssh')
-rwxr-xr-x | perf-framework/pwl_ssh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/perf-framework/pwl_ssh b/perf-framework/pwl_ssh new file mode 100755 index 0000000..fc837f1 --- /dev/null +++ b/perf-framework/pwl_ssh @@ -0,0 +1,50 @@ +#!/usr/bin/expect -f + +proc setup_pwl_ssh { host pw1 pw2 } { + spawn ssh-copy-id -i /root/.ssh/id_rsa.pub root@$host + set timeout 50 + expect { + "yes/no" { + send "yes\r" + exp_continue + } "password: " { + send "$pw1\r" + expect { + "#" { + # Success. Nothing to do + } "password: " { + send "$pw2\r"; + expect { + "#" { + # Success. Nothing to do + } (.*) { + catch {close -i $spawn_id} + wait -nowait -i $spawn_id + } + } + } + } + } timeout { + catch {close -i $spawn_id} + wait -nowait -i $spawn_id + } eof { + } + } +} + +if { $argc < 2 } { + puts "usage $argv0 <logfile> <list-of-hosts>" + exit +} + +log_user 0 +set logfile [ lindex $argv 0 ] +exp_log_file -a -noappend $logfile + +set pw1 $env(ROOT_PW1) +set pw2 $env(ROOT_PW2) + +for {set i 1} {$i<[llength $argv]} {incr i} { + set host [lindex $argv $i] + setup_pwl_ssh $host $pw1 $pw2 +} |