From 57cdaf4fb8c33813c9c85747ed6ff1b8dbdf59ff Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 3 Apr 2018 18:09:32 +0100 Subject: xci: bifrost: Use 'sudo' to install dependencies for bifrost jobs When bifrost jobs are being executed, the virtual environment hasn't been prepared yet because that's something that bifrost does later on. As such, we need to use sudo to install the required dependencies to avoid the following issue: Exception: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install **kwargs File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files isolated=self.isolated, File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files clobber(source, lib_dir, True) File "/usr/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber ensure_dir(destdir) File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir os.makedirs(path) File "/usr/lib64/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/pbr' Change-Id: I081884ec18d27af19a053bf5b734f6f3846c60f1 Signed-off-by: Markos Chandras --- xci/infra/bifrost/scripts/bifrost-provision.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xci/infra/bifrost/scripts/bifrost-provision.sh b/xci/infra/bifrost/scripts/bifrost-provision.sh index 2b849e34..95854e90 100755 --- a/xci/infra/bifrost/scripts/bifrost-provision.sh +++ b/xci/infra/bifrost/scripts/bifrost-provision.sh @@ -100,8 +100,10 @@ if [[ -e ${XCI_PATH}/deployment_image.qcow2 ]]; then sudo mv ${XCI_PATH}/deployment_image.qcow2* /httpboot/ fi -# Install missing dependencies -pip install -q --upgrade -r "$(dirname $0)/../requirements.txt" +# Install missing dependencies. Use sudo since for bifrost jobs +# the venv is not ready yet. +[[ -n ${VIRTUAL_ENV} ]] && _sudo="" || sudo="sudo -H -E" +${_sudo} pip install -q --upgrade -r "$(dirname $0)/../requirements.txt" # Change working directory cd $BIFROST_HOME/playbooks -- cgit 1.2.3-korg