From: Markos Chandras Date: Tue, 12 Sep 2017 21:57:31 +0000 (-0600) Subject: bifrost: Use virtual environment for bifrost X-Git-Tag: 6.0.0~325 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F42011%2F2;p=releng-xci.git bifrost: Use virtual environment for bifrost bifrost forces us to use an old Ansible version which means we can't take advantage of new features in XCI playbooks. As such, we move the entire bifrost step to a virtual environment so we can have a newer version of Ansible on the host. Change-Id: I94874d600a29247b7826324cc111901995df90dc Signed-off-by: Markos Chandras --- diff --git a/bifrost/scripts/bifrost-provision.sh b/bifrost/scripts/bifrost-provision.sh index ad028070..0cca82da 100755 --- a/bifrost/scripts/bifrost-provision.sh +++ b/bifrost/scripts/bifrost-provision.sh @@ -17,7 +17,7 @@ ANSIBLE_INSTALL_ROOT=${ANSIBLE_INSTALL_ROOT:-/opt/stack} ANSIBLE_VERBOSITY=${ANSIBLE_VERBOSITY-"-vvvv"} ENABLE_VENV="false" USE_DHCP="false" -USE_VENV="false" +USE_VENV="true" BUILD_IMAGE=true PROVISION_WAIT_TIMEOUT=${PROVISION_WAIT_TIMEOUT:-3600} @@ -67,6 +67,21 @@ export DIB_OS_PACKAGES=${DIB_OS_PACKAGES:-"vlan,vim,less,bridge-utils,language-p # Additional dib elements export EXTRA_DIB_ELEMENTS=${EXTRA_DIB_ELEMENTS:-"openssh-server"} +if [ ${USE_VENV} = "true" ]; then + export VENV=/opt/stack/bifrost + $SCRIPT_HOME/env-setup.sh + # Note(cinerama): activate is not compatible with "set -u"; + # disable it just for this line. + set +u + source ${VENV}/bin/activate + set -u + ANSIBLE=${VENV}/bin/ansible-playbook + ENABLE_VENV="true" +else + $SCRIPT_HOME/env-setup.sh + ANSIBLE=${HOME}/.local/bin/ansible-playbook +fi + # Source Ansible set +x +o nounset $SCRIPT_HOME/env-setup.sh