Install and run sushy-tools within a virtualenv

This ensures gunicorn can find all required packages at runtime.

Closes-Bug: #2098542
Change-Id: I10279575fc1c060dd439d31ae1c07c1267b04342
This commit is contained in:
cid 2025-03-06 10:40:04 +01:00
parent 25a3dd076a
commit 6af973aee6

View File

@ -1169,6 +1169,8 @@ function cleanup_redfish {
function install_redfish {
# TODO(lucasagomes): Use Apache WSGI instead of gunicorn
. /opt/stack/data/venv/bin/activate
if is_fedora; then
install_package python3-gunicorn
else
@ -1196,8 +1198,15 @@ function install_redfish {
# NOTE(dtantsur): log all accesses to stdout
cmd+=" --access-logfile=- --error-logfile=-"
# Exit virtualenv once installation is complete
deactivate
write_user_unit_file $IRONIC_REDFISH_EMULATOR_SYSTEMD_SERVICE "$cmd" "" "$STACK_USER"
# update unit file reference
local unitfile="$SYSTEMD_DIR/$IRONIC_REDFISH_EMULATOR_SYSTEMD_SERVICE"
iniset -sudo $unitfile "Service" "Environment" "PATH=/opt/stack/data/venv/bin:$PATH"
enable_service $IRONIC_REDFISH_EMULATOR_SYSTEMD_SERVICE
}