diskimage-builder/diskimage_builder/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-install
Mark Hamzy 34ff72f253 upgrade pip before using -c option
The installed pip can be an older version which does not support
the -c argument. Therefore, upgrade pip before using -c.

Change-Id: If18d8ea822a62c8551c9c4d47354d58b0299fed2
Closes-Bug: 1744403
2018-01-19 16:46:59 -06:00

49 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
SCRIPTDIR=$(dirname $0)
IPADIR=/usr/share/ironic-python-agent
# Generate upper-constraints
$IPADIR/imagebuild/common/generate_upper_constraints.sh $IPADIR/upper-constraints.txt
# create the virtual environment
virtualenv $IPADIR/venv
# pip might be an older version which does not support the -c option, therefore upgrade first
$IPADIR/venv/bin/pip install pip --upgrade
# install IPA inside the virtual environment
$IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $IPADIR
# 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/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
update-rc.d ironic-python-agent.init defaults
;;
*)
echo "Unsupported init system"
exit 1
;;
esac
# Copying the self signed certificate for request library
if [ -f /tmp/in_target.d/ipa-trusted-cert.pem ]; then
cat /tmp/in_target.d/ipa-trusted-cert.pem >> $($IPADIR/venv/bin/python -c "import requests; print requests.certs.where()")
fi