diff --git a/elements/ironic-agent/element-deps b/elements/ironic-agent/element-deps index f332d35ba..ee8155c45 100644 --- a/elements/ironic-agent/element-deps +++ b/elements/ironic-agent/element-deps @@ -1,5 +1,6 @@ dhcp-all-interfaces package-installs +pip-and-virtualenv pkg-map source-repositories svc-map diff --git a/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-install b/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-install index 0cac68f59..17ac28316 100755 --- a/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-install +++ b/elements/ironic-agent/install.d/ironic-agent-source-install/60-ironic-agent-install @@ -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 diff --git a/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.conf b/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.conf old mode 100755 new mode 100644 index 4601f19ee..eab283222 --- a/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.conf +++ b/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.conf @@ -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 diff --git a/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.init b/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.init index 83035c26d..7ecb3a0a8 100755 --- a/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.init +++ b/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.init @@ -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 diff --git a/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.service b/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.service old mode 100755 new mode 100644 index a4593caf1..6513cd634 --- a/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.service +++ b/elements/ironic-agent/install.d/ironic-agent-source-install/ironic-python-agent.service @@ -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 diff --git a/elements/ironic-agent/source-repository-ironic-agent b/elements/ironic-agent/source-repository-ironic-agent index 37422952e..f657bdf46 100644 --- a/elements/ironic-agent/source-repository-ironic-agent +++ b/elements/ironic-agent/source-repository-ironic-agent @@ -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