Browse code

Add quotation marks to parse string correclty on rhel7

Problem:
On rhel7 the lvm.conf filter is generated wrongly

Root Cause:

bash-4.2 (rhel7/centos7) incorrectly splits herestrings
when combined with IFS. See [1] and [2]

Quoting the argument is a safe work-around

[1] http://stackoverflow.com/questions/20144593/trying-to-split-a-string-into-two-variables
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1196566

Closes-Bug #1425839
Change-Id: Ie82fcd7ef0deacbb6aaf18c5c466a5d5baf52681

Andreas Scheuring authored on 2015/02/26 17:08:09
Showing 1 changed files
... ...
@@ -78,9 +78,9 @@ function configure_cinder_backend_conf_lvm {
78 78
 
79 79
     for pv_info in $(sudo pvs --noheadings -o name,vg_name --separator ';'); do
80 80
         echo_summary "Evaluate PV info for Cinder lvm.conf: $pv_info"
81
-        IFS=';' read pv vg <<< $pv_info
81
+        IFS=';' read pv vg <<< "$pv_info"
82 82
         for line in ${conf_entries}; do
83
-            IFS='=' read label group <<< $line
83
+            IFS='=' read label group <<< "$line"
84 84
             group=$(echo $group|sed "s/^ *//g")
85 85
             if [[ "$vg" == "$group" ]]; then
86 86
                 new="\"a$pv/\", "