summaryrefslogtreecommitdiffstats
path: root/utils/infra_setup/heat_template/vstf_heat_template/ssh.sh
diff options
context:
space:
mode:
authorJun Li <matthew.lijun@huawei.com>2016-01-09 03:02:06 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-09 03:02:06 +0000
commitf1c3025829798753e4e57b2c6178f1f72957556a (patch)
tree6518c1c89d62b2935429c6cb59c7979631b7f649 /utils/infra_setup/heat_template/vstf_heat_template/ssh.sh
parent6e490df0346e26f9e6cc5dc79029a03e1d17a454 (diff)
parentb8eeff7c6fdbfa5fe308e37a09853a6bc1f20d60 (diff)
Merge "JIRA: BOTTLENECKS-29"
Diffstat (limited to 'utils/infra_setup/heat_template/vstf_heat_template/ssh.sh')
-rw-r--r--utils/infra_setup/heat_template/vstf_heat_template/ssh.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/infra_setup/heat_template/vstf_heat_template/ssh.sh b/utils/infra_setup/heat_template/vstf_heat_template/ssh.sh
new file mode 100644
index 00000000..35600065
--- /dev/null
+++ b/utils/infra_setup/heat_template/vstf_heat_template/ssh.sh
@@ -0,0 +1,28 @@
+function run_cmd()
+{
+ local ip=$1
+ local usr=$2
+ local passwd=$3
+ local cmd=$4
+ expect -c "
+ spawn ssh $usr@$ip
+ set timeout -1
+ expect {
+ \"*no)?\" {
+ send \"yes\r\"
+ exp_continue
+ }
+ \"*assword:*\" {
+ send \"$passwd\r\"
+ exp_continue
+ }
+ \"*#\" {
+ send \"$cmd\r\"
+ exec sleep 1
+ send \"exit\r\"
+ expect eof
+ }
+ }
+ "
+}
+