X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fqa%2Fqa_scripts%2Fopenstack%2Ffix_conf_file.sh;fp=src%2Fceph%2Fqa%2Fqa_scripts%2Fopenstack%2Ffix_conf_file.sh;h=bff2ef3d1c26aeea0d17446ab02e8c6cc5895bee;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/qa/qa_scripts/openstack/fix_conf_file.sh b/src/ceph/qa/qa_scripts/openstack/fix_conf_file.sh new file mode 100755 index 0000000..bff2ef3 --- /dev/null +++ b/src/ceph/qa/qa_scripts/openstack/fix_conf_file.sh @@ -0,0 +1,29 @@ +#/bin/bash -fv +source ./copy_func.sh +# +# Take a templated file, modify a local copy, and write it to the +# remote site. +# +# Usage: fix_conf_file [] +# -- site where we want this modified file stored. +# -- name of the remote file. +# -- directory where the file will be stored +# -- (optional) rbd_secret used by libvirt +# +function fix_conf_file() { + if [[ $# < 3 ]]; then + echo 'fix_conf_file: Too few parameters' + exit 1 + fi + openstack_node_local=${1} + cp files/${2}.template.conf ${2}.conf + hostname=`ssh $openstack_node_local hostname` + inet4addr=`ssh $openstack_node_local hostname -i` + sed -i s/VARHOSTNAME/$hostname/g ${2}.conf + sed -i s/VARINET4ADDR/$inet4addr/g ${2}.conf + if [[ $# == 4 ]]; then + sed -i s/RBDSECRET/${4}/g ${2}.conf + fi + copy_file ${2}.conf $openstack_node_local ${3} 0644 "root:root" + rm ${2}.conf +}