XenAPI: add support to use local.conf
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
This commit is contained in:
parent
147c442547
commit
cc6af3fc94
@ -195,6 +195,25 @@ function merge_config_group {
|
||||
done
|
||||
}
|
||||
|
||||
function extract_localrc_section {
|
||||
local configfile=$1 # top_dir/local.conf
|
||||
local localrcfile=$2 # top_dir/localrc
|
||||
local localautofile=$3 # top_dir/.localrc.auto
|
||||
|
||||
if [[ -r $configfile ]]; then
|
||||
LRC=$(get_meta_section_files $configfile local)
|
||||
for lfile in $LRC; do
|
||||
if [[ "$lfile" == "localrc" ]]; then
|
||||
if [[ -r $localrcfile ]]; then
|
||||
echo "localrc and local.conf:[[local]] both exist, using localrc"
|
||||
else
|
||||
echo "# Generated file, do not edit" >$localautofile
|
||||
get_meta_section $configfile local $lfile >>$localautofile
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Restore xtrace
|
||||
$_XTRACE_INC_META
|
||||
|
14
stack.sh
14
stack.sh
@ -149,19 +149,7 @@ GetDistro
|
||||
|
||||
# Phase: local
|
||||
rm -f $TOP_DIR/.localrc.auto
|
||||
if [[ -r $TOP_DIR/local.conf ]]; then
|
||||
LRC=$(get_meta_section_files $TOP_DIR/local.conf local)
|
||||
for lfile in $LRC; do
|
||||
if [[ "$lfile" == "localrc" ]]; then
|
||||
if [[ -r $TOP_DIR/localrc ]]; then
|
||||
warn $LINENO "localrc and local.conf:[[local]] both exist, using localrc"
|
||||
else
|
||||
echo "# Generated file, do not edit" >$TOP_DIR/.localrc.auto
|
||||
get_meta_section $TOP_DIR/local.conf local $lfile >>$TOP_DIR/.localrc.auto
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
extract_localrc_section $TOP_DIR/local.conf $TOP_DIR/localrc $TOP_DIR/.localrc.auto
|
||||
|
||||
# ``stack.sh`` is customizable by setting environment variables. Override a
|
||||
# default setting via export::
|
||||
|
@ -12,13 +12,6 @@ set -o xtrace
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
# Abort if localrc is not set
|
||||
if [ ! -e ../../localrc ]; then
|
||||
echo "You must have a localrc with ALL necessary passwords defined before proceeding."
|
||||
echo "See the xen README for required passwords."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This directory
|
||||
THIS_DIR=$(cd $(dirname "$0") && pwd)
|
||||
|
||||
@ -31,6 +24,10 @@ THIS_DIR=$(cd $(dirname "$0") && pwd)
|
||||
#
|
||||
# Get Settings
|
||||
#
|
||||
TOP_DIR=$(cd $THIS_DIR/../../ && pwd)
|
||||
source $TOP_DIR/inc/meta-config
|
||||
rm -f $TOP_DIR/.localrc.auto
|
||||
extract_localrc_section $TOP_DIR/local.conf $TOP_DIR/localrc $TOP_DIR/.localrc.auto
|
||||
|
||||
# Source params - override xenrc params in your localrc to suit your taste
|
||||
source $THIS_DIR/xenrc
|
||||
|
Loading…
Reference in New Issue
Block a user