ironic-python-agent-builder/dib/ironic-python-agent-ramdisk/install.d/ironic-python-agent-ramdisk-source-install/60-ironic-python-agent-ramdisk-install
Dmitry Tantsur 19f046112d Update upper-constraints handling
For tinyIPA, migrate the generate_upper_constraints script in-tree.

For DIB, use a source repository with requirements to fetch
upper-constraints. As a nice side effect, it allows depending on
requirements patches in the CI.

Change-Id: I6be51b98adab641cfaa1613306cbdcc3b42de1c2
2019-10-18 12:49:28 +02:00

44 lines
1.4 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=/tmp/ironic-python-agent
UPPER_CONSTRAINTS=/tmp/requirements/upper-constraints.txt
VENVDIR=/opt/ironic-python-agent
# create the virtual environment using the default python
$DIB_PYTHON -m virtualenv -- $VENVDIR
# pip might be an older version which does not support the -c option, therefore upgrade first
$VENVDIR/bin/pip install pip --upgrade
# install IPA inside the virtual environment
$VENVDIR/bin/pip install -c $UPPER_CONSTRAINTS $IPADIR --install-option="--install-scripts=/usr/local/bin/"
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 0644 ${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 >> $($VENVDIR/bin/python -c "import requests; print requests.certs.where()")
fi