From f4a8516c121373dfe31334398e833706eb8a9f7c Mon Sep 17 00:00:00 2001 From: Piotr Parczewski Date: Fri, 28 May 2021 16:27:21 +0200 Subject: [PATCH 1/2] Discover executables location and use conditionally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Depending on OpenStack release, the location IPA and pip installations is different. This commit aims to detect the location and use it automatically. 83fe9809537ff84ed37f4dab0a8c6fdcf7300a09 3805e78c00d978939e6b35d9aed133a42d2d3e14 Co-authored-by: MichaƂ Nasiadka Co-authored-by: Bartosz Bezak Co-authored-by: Doug Szumski --- .../install.d/61-ipa-extra-hardware | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/elements/ipa-extra-hardware/install.d/61-ipa-extra-hardware b/elements/ipa-extra-hardware/install.d/61-ipa-extra-hardware index 128d63f..aaa7d71 100755 --- a/elements/ipa-extra-hardware/install.d/61-ipa-extra-hardware +++ b/elements/ipa-extra-hardware/install.d/61-ipa-extra-hardware @@ -6,17 +6,29 @@ fi set -eu set -o pipefail -IPADIR=/usr/share/ironic-python-agent PACKAGE=${DIB_IPA_HARDWARE_PACKAGE:-hardware${DIB_IPA_HARDWARE_VERSION:+==}${DIB_IPA_HARDWARE_VERSION:-}} -# Install the python hardware package inside the virtual environment. -$IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $PACKAGE +if [[ -d /usr/share/ironic-python-agent ]]; then + IPADIR=/usr/share/ironic-python-agent +else + IPADIR=/opt/ironic-python-agent +fi + +if [[ -d "$IPADIR/venv" ]]; then + $IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $PACKAGE +else + $IPADIR/bin/pip install -c /tmp/requirements/upper-constraints.txt $PACKAGE +fi # Because the ironic-python-agent systemd unit does not activate the virtualenv # before executing the ironic-python-agent script, the PATH is not updated to # point to the bin directory in the virtual environment. We add this symlink so # that ironic-python-agent sees the hardware-detect tool in its PATH. -ln -s $IPADIR/venv/bin/hardware-detect /usr/local/bin/hardware-detect +if [[ -d "$IPADIR/venv" ]]; then + ln -s $IPADIR/venv/bin/hardware-detect /usr/local/bin/hardware-detect +else + ln -s $IPADIR/bin/hardware-detect /usr/local/bin/hardware-detect +fi # Install additional packages as requested. if [[ -n ${DIB_IPA_EXTRA_HARDWARE_PACKAGES:-} ]]; then From 0f68d4819bc995af59c9508336ec7d77df6e1ee5 Mon Sep 17 00:00:00 2001 From: Piotr Parczewski Date: Mon, 7 Jun 2021 09:27:53 +0200 Subject: [PATCH 2/2] Update README --- elements/ipa-extra-hardware/README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elements/ipa-extra-hardware/README.rst b/elements/ipa-extra-hardware/README.rst index 88fa50c..3e5c280 100644 --- a/elements/ipa-extra-hardware/README.rst +++ b/elements/ipa-extra-hardware/README.rst @@ -21,3 +21,6 @@ The following environment variables may be set to configure the element: version will be installed. * ``DIB_IPA_EXTRA_HARDWARE_PACKAGES`` a space-separated list of additional system packages to install. + +For Wallaby and later releases, it is recommended to use an upstream version +of the `element `_.