From 1f52acc1c314bc3f6cf7ad049d2917e273ac2baa Mon Sep 17 00:00:00 2001 From: Logan V Date: Wed, 9 Mar 2016 20:57:05 -0600 Subject: [PATCH] Add support for Horizon customization module Allow the deployer to specify a customization module to be uploaded and configured in Horizon. The process is outlined here in the Horizon documentation: http://docs.openstack.org/developer/horizon/topics/customizing.html#horizon-customization-module-overrides Change-Id: Ie638c826abe43f1f484f16e60b90fbe25c684c6e --- defaults/main.yml | 4 ++++ tasks/horizon_post_install.yml | 23 +++++++++++++++++++++++ templates/horizon_local_settings.py.j2 | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index b3224cba..611f8d7a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -142,6 +142,10 @@ horizon_swift_file_transfer_chunk_size: 524288 ## Panel horizon_default_panel: overview +## Customization module +## See http://docs.openstack.org/developer/horizon/topics/customizing.html#horizon-customization-module-overrides +# horizon_customization_module: /local/path/to/customization_module.py + horizon_webroot: / horizon_listen_ports: diff --git a/tasks/horizon_post_install.yml b/tasks/horizon_post_install.yml index 08822a97..42be3853 100644 --- a/tasks/horizon_post_install.yml +++ b/tasks/horizon_post_install.yml @@ -92,3 +92,26 @@ tags: - horizon-configs - horizon-wsgi-venv + +- name: Create customization module directory + file: + path: "{{ horizon_lib_dir }}/horizon_customization" + state: directory + owner: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + mode: "0755" + when: horizon_customization_module is defined + tags: + - horizon-configs + +- name: Drop horizon customization module + template: + src: "{{ horizon_customization_module }}" + dest: "{{ horizon_lib_dir }}/horizon_customization/__init__.py" + owner: "{{ horizon_system_user_name }}" + group: "{{ horizon_system_group_name }}" + mode: "0644" + notify: Restart apache2 + when: horizon_customization_module is defined + tags: + - horizon-configs diff --git a/templates/horizon_local_settings.py.j2 b/templates/horizon_local_settings.py.j2 index a5d69c65..75ee0898 100644 --- a/templates/horizon_local_settings.py.j2 +++ b/templates/horizon_local_settings.py.j2 @@ -715,3 +715,8 @@ REST_API_REQUIRED_SETTINGS = ['OPENSTACK_HYPERVISOR_FEATURES'] {% if horizon_site_name is defined %} SITE_BRANDING = '{{ horizon_site_name }}' {% endif %} + +{% if horizon_customization_module is defined %} +#custom python module with horizon dashboard theme overrides +HORIZON_CONFIG["customization_module"] = 'horizon_customization.overrides' +{% endif %}