Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions elements/ipa-extra-hardware/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://opendev.org/openstack/ironic-python-agent-builder/src/branch/master/dib/extra-hardware>`_.
20 changes: 16 additions & 4 deletions elements/ipa-extra-hardware/install.d/61-ipa-extra-hardware
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down