Install IPA in a virtual environment

In order to avoid conflict with installing dependencies for IPA from
pypi and distribution packages this patch propose installing IPA in a
virtual environment.

Closes-Bug: #1506792
Change-Id: I6a4c6403813d86f4110e98449ddd874109101b9e
This commit is contained in:
Lucas Alvares Gomes 2015-10-16 11:46:13 +01:00
parent 9e16c8c5f1
commit 006b3e6228
6 changed files with 15 additions and 16 deletions

View File

@ -1,5 +1,6 @@
dhcp-all-interfaces
package-installs
pip-and-virtualenv
pkg-map
source-repositories
svc-map

View File

@ -7,27 +7,25 @@ set -eu
set -o pipefail
SCRIPTDIR=$(dirname $0)
IPADIR=/usr/share/ironic-python-agent
# Install the latest version of pip and setuptools which has some
# fixes for building behind proxy.
curl -o /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
python /tmp/get-pip.py
rm -f /tmp/get-pip.py
pip install -U setuptools
# create the virtual environment
virtualenv $IPADIR/venv
pip install -r /tmp/ironic-python-agent/requirements.txt
pip install /tmp/ironic-python-agent
# install IPA inside the virtual environment
$IPADIR/venv/bin/pip install $IPADIR
if [ ! -f /usr/bin/ironic-python-agent ]; then
ln -s /usr/local/bin/ironic-python-agent /usr/bin/ironic-python-agent
fi
# FIXME(lucasagomes): Figure out how we can use the "--install-option"
# parameter for pip install so we don't have to manually create a symlink
# create the launcher link so services can use it
ln -s $IPADIR/venv/bin/ironic-python-agent /usr/local/bin/ironic-python-agent
case "$DIB_INIT_SYSTEM" in
upstart)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.conf /etc/init/ironic-python-agent.conf
;;
systemd)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.service /usr/lib/systemd/system/$(svc-map ironic-python-agent).service
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.service /usr/lib/systemd/system/ironic-python-agent.service
;;
sysv)
install -D -g root -o root -m 0755 ${SCRIPTDIR}/ironic-python-agent.init /etc/init.d/ironic-python-agent.init

View File

@ -17,4 +17,4 @@ pre-start script
echo Starting Ironic Python Agent
end script
exec /usr/bin/ironic-python-agent
exec /usr/local/bin/ironic-python-agent

View File

@ -12,7 +12,7 @@
NAME=ironic-python-agent
INIT_NAME=/etc/init.d/${NAME}
SCRIPT_NAME=/usr/bin/${NAME}
SCRIPT_NAME=/usr/local/bin/${NAME}
[ -x $SCRIPT_NAME ] || exit 0

View File

@ -3,7 +3,7 @@ Description=Ironic Python Agent
After=network.target
[Service]
ExecStart=/usr/bin/ironic-python-agent
ExecStart=/usr/local/bin/ironic-python-agent
Restart=always
RestartSec=30s

View File

@ -1 +1 @@
ironic-agent git /tmp/ironic-python-agent https://git.openstack.org/openstack/ironic-python-agent
ironic-agent git /usr/share/ironic-python-agent https://git.openstack.org/openstack/ironic-python-agent