Re-written dashboards linking.

Old style of dashboards linking was replaced with find module.
horizon_panels variable was removed. Now deployer may install extra
dashboard with pip package, and it will be linked by role
in case of correct structure and naming.
Task for linking found dashboards was moved to horizon_install_source,
as we don't need linking during installation from packages.
Added _dashboard_panels_location - it's a list with subdirs inside
dashboard folders, where panels should be located.

horizon_panel_enable_state variable was also removed, as we
don't try to link dashboards in post_install anymore.

Depends-on: I708b5cf32e5cce6a18624d0b3be0cd4c828ad389
Change-Id: Ia76d959aa03ff67703bd41bd7ea418ea49a91df7
This commit is contained in:
Dmitriy Rabotjagov 2018-09-04 16:01:01 +03:00
parent c60204dbb9
commit 3d60097f94
7 changed files with 52 additions and 120 deletions

View File

@ -320,23 +320,23 @@ horizon_pip_packages:
- django-appconf
- django-openstack-auth
- greenlet
- heat_dashboard
- horizon
- ironic-ui
- magnum-ui
- keystonemiddleware
- MySQL-python
- PyMySQL
- neutron-lbaas-dashboard
- neutron-fwaas-dashboard
- oslo.config
- ply
- python-memcached
- python-keystoneclient
- sahara_dashboard
- trove_dashboard
- designate_dashboard
- octavia_dashboard
- "{{ horizon_enable_sahara_ui | ternary('sahara_dashboard', '') }}"
- "{{ horizon_enable_trove_ui | ternary('trove_dashboard', '') }}"
- "{{ horizon_enable_magnum_ui | ternary('magnum-ui', '') }}"
- "{{ horizon_enable_heat_ui | ternary('heat_dashboard', '') }}"
- "{{ horizon_enable_ironic_ui | ternary('ironic-ui', '') }}"
- "{{ horizon_enable_designate_ui | ternary('designate_dashboard', '') }}"
- "{{ horizon_enable_neutron_lbaas | ternary('neutron-lbaas-dashboard', '') }}"
- "{{ horizon_enable_neutron_fwaas | ternary('neutron-fwaas-dashboard', '') }}"
- "{{ horizon_enable_octavia_ui | ternary('octavia_dashboard', '') }}"
# This variable is used to install additional pip packages
# that could be needed for additional dashboards
@ -373,5 +373,3 @@ horizon_keystone_admin_roles:
# The list of authentication mechanisms which include keystone
# federation protocols and identity provider/federation protocol
horizon_websso_initial_choice: "credentials"
horizon_panels: "{{ _horizon_panels }}"

View File

@ -51,7 +51,7 @@
- name: Install distro packages
package:
name: "{{ horizon_package_list}}"
name: "{{ horizon_package_list }}"
state: "{{ horizon_package_state }}"
update_cache: "{{ (ansible_pkg_mgr == 'apt') | ternary('yes', omit) }}"
cache_valid_time: "{{ (ansible_pkg_mgr == 'apt') | ternary(cache_timeout, omit) }}"

View File

@ -92,3 +92,41 @@
- { path: "{{ horizon_lib_dir }}/openstack_dashboard", mode: "2755" }
- { path: "{{ horizon_lib_dir }}/openstack_dashboard/local", mode: "2755" }
- { path: "{{ horizon_lib_dir }}/openstack_dashboard/local/enabled", mode: "2755" }
- name: Registering dashboards
find:
paths: "{{ horizon_lib_dir }}"
patterns: "^.*(dashboard|ui)$"
file_type: directory
use_regex: yes
excludes: "openstack_dashboard"
recurse: no
register: found_dashboards
# NOTE(noonedeadpunk):
# patterns made not optimal, as ansible find module doesn't
# process regexp with repeats, like [0-9]{2,4}.
# Bug describing this issue:
# https://github.com/ansible/ansible/issues/45048
- name: Registering panels
find:
paths: |-
{% set dashboard_path = [] %}
{% for dashboard in found_dashboards.files %}
{% for path in _dashboard_panels_location %}
{% set _ = dashboard_path.append(dashboard.path + path) %}
{% endfor %}
{% endfor %}
{{ dashboard_path }}
patterns: "^(_[0-9]{4}_.*.py|_[0-9]{2}_.*.py|.*_policy.json)$"
file_type: file
use_regex: yes
register: found_panels
- name: Enable project panels
file:
src: "{{ item.path }}"
path: "{{ horizon_dashboard_panel_dir }}/{{ item.path|basename }}"
state: link
with_items: "{{ found_panels.files }}"
notify: Restart apache2

View File

@ -48,14 +48,6 @@
dest: "{{ horizon_lib_dir }}/openstack_dashboard/static/dashboard/{{ item.value.dest }}"
with_dict: "{{ horizon_custom_uploads | default({}) }}"
- name: Enable project panels
file:
src: "{{ item.src }}"
path: "{{ item.path }}"
state: "{{ item.state }}"
with_items: "{{ horizon_panels }}"
notify: Restart apache2
- name: Create horizon links
file:
src: "{{ item.src }}"

View File

@ -17,6 +17,3 @@ horizon_package_list: "{{ horizon_distro_packages + horizon_service_distro_packa
_horizon_bin: "/usr/bin"
horizon_manage: "{{ ansible_python.executable }} {{ horizon_lib_dir }}/manage.py"
# NOTE(hwoarang): Distributions ship regular files in _horizon_lib_dir so we need
# to set the proper state in the file module
horizon_panel_enable_state: "file"

View File

@ -13,104 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
_horizon_panels:
- src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1610_project_orchestration_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1610_project_orchestration_panel.py"
state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1620_project_stacks_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1620_project_stacks_panel.py"
state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1630_project_resource_types_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1630_project_resource_types_panel.py"
state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1640_project_template_versions_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1640_project_template_versions_panel.py"
state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/heat_dashboard/enabled/_1650_project_template_generator_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1650_project_template_generator_panel.py"
state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/heat_dashboard/local_settings.d/_1699_orchestration_settings.py"
path: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.d/_1699_orchestration_settings.py"
state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/heat_dashboard/conf/heat_policy.json"
path: "{{ horizon_lib_dir }}/openstack_dashboard/conf/heat_policy.json"
state: "{{ horizon_enable_heat_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1710_project_dns_panel_group.py"
path: "{{ horizon_dashboard_panel_dir }}/_1710_project_dns_panel_group.py"
state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1720_project_dns_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1720_project_dns_panel.py"
state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1721_dns_zones_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1721_dns_zones_panel.py"
state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/designatedashboard/enabled/_1722_dns_reversedns_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1722_dns_reversedns_panel.py"
state: "{{ horizon_enable_designate_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/ironic_ui/enabled/_2200_ironic.py"
path: "{{ horizon_dashboard_panel_dir }}/_2200_ironic.py"
state: "{{ horizon_enable_ironic_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/magnum_ui/enabled/_1370_project_container_infra_panel_group.py"
path: "{{ horizon_dashboard_panel_dir }}/_1370_project_container_infra_panel_group.py"
state: "{{ horizon_enable_magnum_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/magnum_ui/enabled/_1371_project_container_infra_clusters_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1371_project_container_infra_clusters_panel.py"
state: "{{ horizon_enable_magnum_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/magnum_ui/enabled/_1372_project_container_infra_cluster_templates_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1372_project_container_infra_cluster_templates_panel.py"
state: "{{ horizon_enable_magnum_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1810_data_processing_panel_group.py"
path: "{{ horizon_dashboard_panel_dir }}/_1810_data_processing_panel_group.py"
state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1820_data_processing_clusters_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1820_data_processing_clusters_panel.py"
state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1830_data_processing_plugins_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1830_data_processing_plugins_panel.py"
state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/sahara_dashboard/enabled/_1840_data_processing_jobs_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1840_data_processing_jobs_panel.py"
state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/sahara_dashboard/local_settings.d/_12_toggle_data_upload_max_number_fields.py"
path: "{{ horizon_lib_dir }}/openstack_dashboard/local/local_settings.d/_12_toggle_data_upload_max_number_fields.py"
state: "{{ horizon_enable_sahara_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1710_database_panel_group.py"
path: "{{ horizon_dashboard_panel_dir }}/_1710_database_panel_group.py"
state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1720_project_databases_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1720_project_databases_panel.py"
state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1730_project_database_backups_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1730_project_database_backups_panel.py"
state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1731_project_database_backups_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1731_project_database_backups_panel.py"
state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1740_project_database_clusters_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1740_project_database_clusters_panel.py"
state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/trove_dashboard/enabled/_1760_project_database_configurations_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1760_project_database_configurations_panel.py"
state: "{{ horizon_enable_trove_ui | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1481_project_ng_loadbalancersv2_panel.py"
state: "{{ (horizon_enable_neutron_lbaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/neutron_fwaas_dashboard/enabled/_7010_project_firewalls_common.py"
path: "{{ horizon_dashboard_panel_dir }}/_7010_project_firewalls_common.py"
state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/neutron_fwaas_dashboard/enabled/_7011_project_firewalls_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_7011_project_firewalls_panel.py"
state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/neutron_fwaas_dashboard/enabled/_7012_project_firewalls_v2_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_7012_project_firewalls_v2_panel.py"
state: "{{ (horizon_enable_neutron_fwaas | bool) | ternary(horizon_panel_enable_state, 'absent') }}"
- src: "{{ horizon_lib_dir }}/octavia_dashboard/enabled/_1482_project_load_balancer_panel.py"
path: "{{ horizon_dashboard_panel_dir }}/_1482_project_load_balancer_panel.py"
state: "{{ (horizon_enable_octavia_ui | bool) | ternary(horizon_panel_enable_state, 'absent') }}"
_horizon_translations_pull:
- project: "horizon"
enabled: True
- project: "heat-dashboard"
enabled: "{{ horizon_enable_heat_ui }}"

View File

@ -17,5 +17,8 @@ _horizon_bin: "/openstack/venvs/horizon-{{ horizon_venv_tag }}/bin"
_horizon_lib_dir: "{{ _horizon_bin | dirname }}/lib/python2.7/dist-packages"
horizon_python_lib_dir: "{{ _horizon_lib_dir }}"
horizon_manage: "{{ _horizon_bin }}/horizon-manage.py"
horizon_panel_enable_state: "link"
horizon_dashboard_panel_dir: "{{ _horizon_lib_dir }}/openstack_dashboard/local/enabled"
_dashboard_panels_location:
- "/enabled"
- "/conf"
- "/local_settings.d"