Skip to content

Commit f4a8516

Browse files
cityofshipsmnasiadkabbezakdougszumski
committed
Discover executables location and use conditionally
Depending on OpenStack release, the location IPA and pip installations is different. This commit aims to detect the location and use it automatically. 83fe980 3805e78 Co-authored-by: Michał Nasiadka <michal@stackhpc.com> Co-authored-by: Bartosz Bezak <bartosz@stackhpc.com> Co-authored-by: Doug Szumski <doug@stackhpc.com>
1 parent 514d51f commit f4a8516

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

elements/ipa-extra-hardware/install.d/61-ipa-extra-hardware

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,29 @@ fi
66
set -eu
77
set -o pipefail
88

9-
IPADIR=/usr/share/ironic-python-agent
109
PACKAGE=${DIB_IPA_HARDWARE_PACKAGE:-hardware${DIB_IPA_HARDWARE_VERSION:+==}${DIB_IPA_HARDWARE_VERSION:-}}
1110

12-
# Install the python hardware package inside the virtual environment.
13-
$IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $PACKAGE
11+
if [[ -d /usr/share/ironic-python-agent ]]; then
12+
IPADIR=/usr/share/ironic-python-agent
13+
else
14+
IPADIR=/opt/ironic-python-agent
15+
fi
16+
17+
if [[ -d "$IPADIR/venv" ]]; then
18+
$IPADIR/venv/bin/pip install -c $IPADIR/upper-constraints.txt $PACKAGE
19+
else
20+
$IPADIR/bin/pip install -c /tmp/requirements/upper-constraints.txt $PACKAGE
21+
fi
1422

1523
# Because the ironic-python-agent systemd unit does not activate the virtualenv
1624
# before executing the ironic-python-agent script, the PATH is not updated to
1725
# point to the bin directory in the virtual environment. We add this symlink so
1826
# that ironic-python-agent sees the hardware-detect tool in its PATH.
19-
ln -s $IPADIR/venv/bin/hardware-detect /usr/local/bin/hardware-detect
27+
if [[ -d "$IPADIR/venv" ]]; then
28+
ln -s $IPADIR/venv/bin/hardware-detect /usr/local/bin/hardware-detect
29+
else
30+
ln -s $IPADIR/bin/hardware-detect /usr/local/bin/hardware-detect
31+
fi
2032

2133
# Install additional packages as requested.
2234
if [[ -n ${DIB_IPA_EXTRA_HARDWARE_PACKAGES:-} ]]; then

0 commit comments

Comments
 (0)