diff options
author | Jun Li <matthew.lijun@huawei.com> | 2016-01-09 03:02:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2016-01-09 03:02:06 +0000 |
commit | f1c3025829798753e4e57b2c6178f1f72957556a (patch) | |
tree | 6518c1c89d62b2935429c6cb59c7979631b7f649 /utils/infra_setup/heat_template/vstf_heat_template/scp.sh | |
parent | 6e490df0346e26f9e6cc5dc79029a03e1d17a454 (diff) | |
parent | b8eeff7c6fdbfa5fe308e37a09853a6bc1f20d60 (diff) |
Merge "JIRA: BOTTLENECKS-29"
Diffstat (limited to 'utils/infra_setup/heat_template/vstf_heat_template/scp.sh')
-rw-r--r-- | utils/infra_setup/heat_template/vstf_heat_template/scp.sh | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/utils/infra_setup/heat_template/vstf_heat_template/scp.sh b/utils/infra_setup/heat_template/vstf_heat_template/scp.sh new file mode 100644 index 00000000..b3d6a27b --- /dev/null +++ b/utils/infra_setup/heat_template/vstf_heat_template/scp.sh @@ -0,0 +1,93 @@ +function scp_cmd() +{ + local ip=$1 + local usr=$2 + local passwd=$3 + srcfile=$4 + desfile=$5 + opt=$6 + case $opt in + file) + expect -c " + spawn scp -r $srcfile $usr@$ip:$desfile + set timeout -1 + expect { + \"*no)?\" { + send \"yes\r\" + exp_continue + } + \"*assword:*\" { + send \"$passwd\r\" + exp_continue + } + } + " + ;; + dir) + expect -c " + spawn scp -r $srcfile $usr@$ip:$desfile + set timeout -1 + expect { + \"*no)?\" { + send \"yes\r\" + exp_continue + } + \"*assword:*\" { + send \"$passwd\r\" + exp_continue + } + } + " + ;; + *) + echo "err" + ;; + esac +} + +function remote_scp_cmd() +{ + local ip=$1 + local usr=$2 + local passwd=$3 + srcfile=$4 + desfile=$5 + opt=$6 + case $opt in + file) + expect -c " + spawn scp -r $usr@$ip:$srcfile $desfile + set timeout -1 + expect { + \"*no)?\" { + send \"yes\r\" + exp_continue + } + \"*assword:*\" { + send \"$passwd\r\" + exp_continue + } + } + " + ;; + dir) + expect -c " + spawn scp -r $usr@$ip:$srcfile $desfile + set timeout -1 + expect { + \"*no)?\" { + send \"yes\r\" + exp_continue + } + \"*assword:*\" { + send \"$passwd\r\" + exp_continue + } + } + " + ;; + *) + echo "err" + ;; + esac +} |