XenServer install with devstack doesn't support local.conf, this fix
is to add support for using local.conf and backward-compatibility of
localrc
Change-Id: Ie494e01f8f1ecb8720e14392ef3f12d5a5a01dcd
Closes-Bug: #1528520
... | ... |
@@ -195,6 +195,25 @@ function merge_config_group { |
195 | 195 |
done |
196 | 196 |
} |
197 | 197 |
|
198 |
+function extract_localrc_section { |
|
199 |
+ local configfile=$1 # top_dir/local.conf |
|
200 |
+ local localrcfile=$2 # top_dir/localrc |
|
201 |
+ local localautofile=$3 # top_dir/.localrc.auto |
|
202 |
+ |
|
203 |
+ if [[ -r $configfile ]]; then |
|
204 |
+ LRC=$(get_meta_section_files $configfile local) |
|
205 |
+ for lfile in $LRC; do |
|
206 |
+ if [[ "$lfile" == "localrc" ]]; then |
|
207 |
+ if [[ -r $localrcfile ]]; then |
|
208 |
+ echo "localrc and local.conf:[[local]] both exist, using localrc" |
|
209 |
+ else |
|
210 |
+ echo "# Generated file, do not edit" >$localautofile |
|
211 |
+ get_meta_section $configfile local $lfile >>$localautofile |
|
212 |
+ fi |
|
213 |
+ fi |
|
214 |
+ done |
|
215 |
+ fi |
|
216 |
+} |
|
198 | 217 |
|
199 | 218 |
# Restore xtrace |
200 | 219 |
$_XTRACE_INC_META |
... | ... |
@@ -149,19 +149,7 @@ GetDistro |
149 | 149 |
|
150 | 150 |
# Phase: local |
151 | 151 |
rm -f $TOP_DIR/.localrc.auto |
152 |
-if [[ -r $TOP_DIR/local.conf ]]; then |
|
153 |
- LRC=$(get_meta_section_files $TOP_DIR/local.conf local) |
|
154 |
- for lfile in $LRC; do |
|
155 |
- if [[ "$lfile" == "localrc" ]]; then |
|
156 |
- if [[ -r $TOP_DIR/localrc ]]; then |
|
157 |
- warn $LINENO "localrc and local.conf:[[local]] both exist, using localrc" |
|
158 |
- else |
|
159 |
- echo "# Generated file, do not edit" >$TOP_DIR/.localrc.auto |
|
160 |
- get_meta_section $TOP_DIR/local.conf local $lfile >>$TOP_DIR/.localrc.auto |
|
161 |
- fi |
|
162 |
- fi |
|
163 |
- done |
|
164 |
-fi |
|
152 |
+extract_localrc_section $TOP_DIR/local.conf $TOP_DIR/localrc $TOP_DIR/.localrc.auto |
|
165 | 153 |
|
166 | 154 |
# ``stack.sh`` is customizable by setting environment variables. Override a |
167 | 155 |
# default setting via export:: |
... | ... |
@@ -12,13 +12,6 @@ set -o xtrace |
12 | 12 |
|
13 | 13 |
export LC_ALL=C |
14 | 14 |
|
15 |
-# Abort if localrc is not set |
|
16 |
-if [ ! -e ../../localrc ]; then |
|
17 |
- echo "You must have a localrc with ALL necessary passwords defined before proceeding." |
|
18 |
- echo "See the xen README for required passwords." |
|
19 |
- exit 1 |
|
20 |
-fi |
|
21 |
- |
|
22 | 15 |
# This directory |
23 | 16 |
THIS_DIR=$(cd $(dirname "$0") && pwd) |
24 | 17 |
|
... | ... |
@@ -31,6 +24,10 @@ THIS_DIR=$(cd $(dirname "$0") && pwd) |
31 | 31 |
# |
32 | 32 |
# Get Settings |
33 | 33 |
# |
34 |
+TOP_DIR=$(cd $THIS_DIR/../../ && pwd) |
|
35 |
+source $TOP_DIR/inc/meta-config |
|
36 |
+rm -f $TOP_DIR/.localrc.auto |
|
37 |
+extract_localrc_section $TOP_DIR/local.conf $TOP_DIR/localrc $TOP_DIR/.localrc.auto |
|
34 | 38 |
|
35 | 39 |
# Source params - override xenrc params in your localrc to suit your taste |
36 | 40 |
source $THIS_DIR/xenrc |