diff options
author | 2018-04-06 20:28:10 +0100 | |
---|---|---|
committer | 2018-05-18 11:20:52 +0100 | |
commit | f95ad15a811c3111b42c09f569d0f1f303a8b597 (patch) | |
tree | 26ed83a35b01f267dbf14df1b67e60ccbb69dae2 /xci | |
parent | 02f2ee5f3f047f6ee5f4e570a0cb5599460de0a5 (diff) |
xci: Move sourcing of configuration files to the install-lib.sh
The install-lib.sh assumes that certain configuration files have been
loaded before it's sourced. However, this doesn't work well when other
scripts are using install-lib.sh directly since they also need to load
the same configuration files. As such, lets source all these
configuration files from the install-lib.sh file directly. We also
rename this file to 'xci-lib.sh' since it's not just about installation
helpers anymore.
Change-Id: I35e1e804db06b2bb512e4991e5fdf21a72ffaadb
Signed-off-by: Markos Chandras <mchandras@suse.de>
Diffstat (limited to 'xci')
-rw-r--r-- | xci/files/xci-lib.sh (renamed from xci/files/install-lib.sh) | 18 | ||||
-rwxr-xr-x | xci/xci-deploy.sh | 27 |
2 files changed, 23 insertions, 22 deletions
diff --git a/xci/files/install-lib.sh b/xci/files/xci-lib.sh index af86be41..bdb64513 100644 --- a/xci/files/install-lib.sh +++ b/xci/files/xci-lib.sh @@ -7,9 +7,21 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# NOTE(hwoarang): Most parts of this this file were taken from the -# bifrost repository (scripts/install-deps.sh). This script contains all -# the necessary distro specific code to install ansible and it's dependencies. +function bootstrap_xci_env() { + # Declare our virtualenv + export XCI_VENV=${XCI_PATH}/venv/ + + # source user vars + source $XCI_PATH/xci/config/user-vars + # source pinned versions + source $XCI_PATH/xci/config/pinned-versions + # source flavor configuration + source "$XCI_PATH/xci/config/${XCI_FLAVOR}-vars" + # source installer configuration + source "$XCI_PATH/xci/installer/${INSTALLER_TYPE}/env" &>/dev/null || true + # source xci configuration + source $XCI_PATH/xci/config/env-vars +} function install_ansible() { set -eu diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh index a04fb21e..6f7490bd 100755 --- a/xci/xci-deploy.sh +++ b/xci/xci-deploy.sh @@ -81,20 +81,8 @@ fi #------------------------------------------------------------------------------- # find where are we export XCI_PATH="$(git rev-parse --show-toplevel)" -# Declare our virtualenv -export XCI_VENV=${XCI_PATH}/venv/ -# source user vars -source $XCI_PATH/xci/config/user-vars -# source pinned versions -source $XCI_PATH/xci/config/pinned-versions -# source flavor configuration -source "$XCI_PATH/xci/config/${XCI_FLAVOR}-vars" -# source installer configuration -source "$XCI_PATH/xci/installer/${INSTALLER_TYPE}/env" &>/dev/null || true -# source xci configuration -source $XCI_PATH/xci/config/env-vars # source helpers library -source ${XCI_PATH}/xci/files/install-lib.sh +source ${XCI_PATH}/xci/files/xci-lib.sh # Make sure we pass XCI_PATH everywhere export XCI_ANSIBLE_PARAMS+=" -e xci_path=${XCI_PATH}" @@ -114,17 +102,18 @@ for local_user_var in ${user_local_dev_vars[@]}; do done unset user_local_dev_vars local_user_var -# register our handler -trap exit_trap ERR - -# We are using sudo so we need to make sure that env_reset is not present -sudo sed -i "s/^Defaults.*env_reset/#&/" /etc/sudoers - # # Bootstrap environment for XCI Deployment # echo "Info: Preparing host environment for the XCI deployment" echo "-------------------------------------------------------------------------" +bootstrap_xci_env + +# register our handler +trap exit_trap ERR + +# We are using sudo so we need to make sure that env_reset is not present +sudo sed -i "s/^Defaults.*env_reset/#&/" /etc/sudoers #------------------------------------------------------------------------------- # Clean up environment |