summaryrefslogtreecommitdiffstats
path: root/qa/qa_scripts/openstack/fix_conf_file.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /qa/qa_scripts/openstack/fix_conf_file.sh
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qa/qa_scripts/openstack/fix_conf_file.sh')
-rwxr-xr-xqa/qa_scripts/openstack/fix_conf_file.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/qa/qa_scripts/openstack/fix_conf_file.sh b/qa/qa_scripts/openstack/fix_conf_file.sh
new file mode 100755
index 000000000..8ccd27249
--- /dev/null
+++ b/qa/qa_scripts/openstack/fix_conf_file.sh
@@ -0,0 +1,28 @@
+source ./copy_func.sh
+#
+# Take a templated file, modify a local copy, and write it to the
+# remote site.
+#
+# Usage: fix_conf_file <remote-site> <file-name> <remote-location> [<rbd-secret>]
+# <remote-site> -- site where we want this modified file stored.
+# <file-name> -- name of the remote file.
+# <remote-location> -- directory where the file will be stored
+# <rbd-secret> -- (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
+}