Fix horizon distro installation for EL

RDO is installing Horizon not under site-packages, but under /usr/share
which makes it completely different logic, with default horizon-manage
not working, as it can not import openstack_dashboard now, as

Change-Id: I4c06b4b5a206b087a9fce856f5fec936e058e3f8
This commit is contained in:
Dmitriy Rabotyagov 2024-06-04 19:47:13 +02:00
parent 3a0f43cd06
commit 25047cd997
3 changed files with 6 additions and 1 deletions

View File

@ -14,7 +14,7 @@
# limitations under the License. # limitations under the License.
- name: Define horizon_lib_dir when it's not set - name: Define horizon_lib_dir when it's not set
when: horizon_lib_dir is not defined when: horizon_lib_dir is not defined or (horizon_lib_dir is defined and not horizon_lib_dir)
block: block:
- name: Find the venv's python version - name: Find the venv's python version
command: "{{ horizon_bin }}/{{ horizon_venv_python_executable }} -c 'import horizon; print(horizon.__file__)'" command: "{{ horizon_bin }}/{{ horizon_venv_python_executable }} -c 'import horizon; print(horizon.__file__)'"

View File

@ -18,6 +18,9 @@ import sys
from django.core.management import execute_from_command_line # noqa from django.core.management import execute_from_command_line # noqa
if __name__ == "__main__": if __name__ == "__main__":
{% if horizon_install_method == 'distro' and (ansible_facts['os_family'] | lower == 'redhat') %}
sys.path.append('{{ horizon_lib_dir }}')
{% endif %}
os.environ.setdefault("DJANGO_SETTINGS_MODULE", os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"openstack_dashboard.settings") "openstack_dashboard.settings")
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)

View File

@ -25,3 +25,5 @@ horizon_package_list: >-
}} }}
_horizon_bin: "/usr/bin" _horizon_bin: "/usr/bin"
horizon_lib_dir: "{{ (ansible_facts['os_family'] | lower == 'redhat') | ternary('/usr/share/openstack-dashboard', None) }}"