Merge "Fix some virtualenv-related places"

This commit is contained in:
Jenkins 2017-03-17 08:22:22 +00:00 committed by Gerrit Code Review
commit 0fb1dbac08
5 changed files with 13 additions and 7 deletions

View File

@ -80,10 +80,10 @@
source_install={{ ironicclient_source_install }}
when: skip_install is not defined
- name: "Install configparser in venv if using"
include: pip_install.yml package=configparser virtualenv=bifrost_venv_dir
include: pip_install.yml package=configparser virtualenv={{ bifrost_venv_dir }}
when: skip_install is not defined and (enable_venv | bool == true)
- name: "Install pymysql in venv if using"
include: pip_install.yml package=pymysql virtualenv=bifrost_venv_dir
include: pip_install.yml package=pymysql virtualenv={{ bifrost_venv_dir }}
when: skip_install is not defined and (enable_venv | bool == true)
- name: "Install Ironic using pip"
include: pip_install.yml

View File

@ -13,12 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
---
- name: set virtualenv_command
set_fact:
venv_command: "{{ hostvars[inventory_hostname].ansible_python.executable }} -m virtualenv"
when: enable_venv
- name: "Install {{ package }} package from pip"
pip:
name: "{{ package }}"
state: "{{ state | default(omit) }}"
version: "{{ version | default(omit) }}"
virtualenv: "{{ bifrost_venv_dir if enable_venv else omit }}"
virtualenv_command: "{{ venv_command | default(omit) }}"
extra_args: "{{ extra_args | default(omit) }}"
when: source_install is not defined or source_install == false
# NOTE (cinerama): We should be able to use the pip module here and

View File

@ -10,7 +10,7 @@ ANSIBLE_PIP_VERSION=${ANSIBLE_PIP_VERSION:-${ANSIBLE_GIT_BRANCH:-stable-2.1}}
ANSIBLE_PIP_STRING=$(${PYTHON} $(dirname $0)/ansible-pip-str.py ${ANSIBLE_PIP_VERSION})
if [ -n "${VENV-}" ]; then
${PIP} install --upgrade "${ANSIBLE_PIP_STRING}"
sudo -H -E ${PIP} install --upgrade "${ANSIBLE_PIP_STRING}"
ANSIBLE=${VENV}/bin/ansible
else
${PIP} install --user --upgrade "${ANSIBLE_PIP_STRING}"

View File

@ -82,7 +82,7 @@ if ! $(wget --version &>/dev/null); then
${INSTALLER_CMD} ${PKG_MAP[wget]}
fi
if [ -n "${VENV-}" ]; then
if $(virtualenv --version &>/dev/null); then
if ! $(python -m virtualenv --version &>/dev/null); then
${INSTALLER_CMD} ${PKG_MAP[venv]}
fi
fi
@ -105,7 +105,7 @@ if [ -n "${VENV-}" ]; then
echo "NOTICE: Using virtualenv for this installation."
if [ ! -f ${VENV}/bin/activate ]; then
# only create venv if one doesn't exist
sudo -H -E virtualenv --no-site-packages ${VENV}
sudo -H -E python -m virtualenv --no-site-packages ${VENV}
fi
# Note(cinerama): activate is not compatible with "set -u";
# disable it just for this line.

View File

@ -94,12 +94,11 @@ fi
if [ ${USE_VENV} = "true" ]; then
export VENV=/opt/stack/bifrost
export PATH=${VENV}/bin:${PATH}
$SCRIPT_HOME/env-setup.sh
# Note(cinerama): activate is not compatible with "set -u";
# disable it just for this line.
set +u
source /opt/stack/bifrost/bin/activate
source ${VENV}/bin/activate
set -u
ANSIBLE=${VENV}/bin/ansible-playbook
ENABLE_VENV="true"