]> git.proxmox.com Git - ceph.git/blob - ceph/qa/qa_scripts/openstack/fix_conf_file.sh
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / qa / qa_scripts / openstack / fix_conf_file.sh
1 #/bin/bash -fv
2 source ./copy_func.sh
3 #
4 # Take a templated file, modify a local copy, and write it to the
5 # remote site.
6 #
7 # Usage: fix_conf_file <remote-site> <file-name> <remote-location> [<rbd-secret>]
8 # <remote-site> -- site where we want this modified file stored.
9 # <file-name> -- name of the remote file.
10 # <remote-location> -- directory where the file will be stored
11 # <rbd-secret> -- (optional) rbd_secret used by libvirt
12 #
13 function fix_conf_file() {
14 if [[ $# < 3 ]]; then
15 echo 'fix_conf_file: Too few parameters'
16 exit 1
17 fi
18 openstack_node_local=${1}
19 cp files/${2}.template.conf ${2}.conf
20 hostname=`ssh $openstack_node_local hostname`
21 inet4addr=`ssh $openstack_node_local hostname -i`
22 sed -i s/VARHOSTNAME/$hostname/g ${2}.conf
23 sed -i s/VARINET4ADDR/$inet4addr/g ${2}.conf
24 if [[ $# == 4 ]]; then
25 sed -i s/RBDSECRET/${4}/g ${2}.conf
26 fi
27 copy_file ${2}.conf $openstack_node_local ${3} 0644 "root:root"
28 rm ${2}.conf
29 }