[devstack] use $PYTHON when configuring horizon

Devstack gained the ablity to install all services in
a shared venv and became the default way to install
on all debian derived distor as part of
If9bc7ba45522189d03f19b86cb681bb150ee2f25

Today the plugin uses the system python3 executable
to invoke the manage.py untility to collect the static
resouces and compress them.

This change updates the devtack plugin to support
installation in the global venv.

When horizon is installed in a global venv the manage command
cannot import django or other depencies if invoked by
system python directly.

When installed in a global virutal environment,
devstack exports PYTHON to use the virtual env executeable.
```export PYTHON="$DEVSTACK_VENV/bin/python3"```
when a gobal venv is not enabled it export PYTHON
to use the correct system python
```export PYTHON=$(which python${PYTHON3_VERSION} 2>/dev/null)```

As such we can always rely on $PYTHON to contain the correct
execuable.

Closes-Bug: #2085487
Change-Id: I161db1e824ee2fafd305313a729795ed2ade634a
This commit is contained in:
Sean Mooney 2024-10-24 02:47:43 +01:00
parent 0451ec9c5f
commit 1d2856a416

View File

@ -13,8 +13,8 @@ function configure_watcher_dashboard {
function init_watcher_dashboard {
# Setup alias for django-admin which could be different depending on distro
python3 ${DEST}/horizon/manage.py collectstatic --noinput
python3 ${DEST}/horizon/manage.py compress --force
$PYTHON ${DEST}/horizon/manage.py collectstatic --noinput
$PYTHON ${DEST}/horizon/manage.py compress --force
}
# check for service enabled