4 # Take a templated file, modify a local copy, and write it to the
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
13 function fix_conf_file() {
15 echo 'fix_conf_file: Too few parameters'
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
27 copy_file ${2}.conf $openstack_node_local ${3} 0644 "root:root"