X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fqa%2Fqa_scripts%2Fopenstack%2Fcopy_func.sh;fp=src%2Fceph%2Fqa%2Fqa_scripts%2Fopenstack%2Fcopy_func.sh;h=29589765474ed6dc37399dd719a4ee623e7566f5;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/qa/qa_scripts/openstack/copy_func.sh b/src/ceph/qa/qa_scripts/openstack/copy_func.sh new file mode 100755 index 0000000..2958976 --- /dev/null +++ b/src/ceph/qa/qa_scripts/openstack/copy_func.sh @@ -0,0 +1,23 @@ +#/bin/bash -fv +# +# copy_file(, , , [], [] +# +# copy a file -- this is needed because passwordless ssh does not +# work when sudo'ing. +# -- name of local file to be copied +# -- node where we want the file +# -- location where we want the file on +# -- (optional) permissions on the copied file +# -- (optional) owner of the copied file +# +function copy_file() { + fname=`basename ${1}` + scp ${1} ${2}:/tmp/${fname} + ssh ${2} sudo cp /tmp/${fname} ${3} + if [ $# -gt 3 ]; then + ssh ${2} sudo chmod ${4} ${3}/${fname} + fi + if [ $# -gt 4 ]; then + ssh ${2} sudo chown ${5} ${3}/${fname} + fi +}