Comment 3 for bug 1778098

Revision history for this message
Dmitriy Rabotyagov (noonedeadpunk) wrote :

Hi,

I couldn't reproduce collection fail. In my case theme is placed under /opt/themes/ , like this:
root@eustackdeploy:/opt/openstack-ansible/playbooks# ls -l /opt/themes/
total 4
drwxr-xr-x 3 techs techs 4096 Jul 4 17:47 my_theme
root@eustackdeploy:/opt/openstack-ansible/playbooks# ls -l /opt/themes/my_theme
total 64
drwxr-xr-x 3 techs techs 4096 Jul 4 17:47 horizon
-rw-r--r-- 1 techs techs 2677 Jul 4 17:47 logo_51x35_transp.png
-rw-r--r-- 1 techs techs 6692 Jul 4 17:47 _styles.scss
-rw-r--r-- 1 techs techs 29836 Jul 4 17:47 _variables.scss
-rw-r--r-- 1 techs techs 4336 Jul 4 17:47 login-bg.png
-rw-r--r-- 1 techs techs 5105 Jul 4 17:47 login-logo.png
root@eustackdeploy:/opt/openstack-ansible/playbooks#

And variable set like this:
horizon_custom_theme_path: /opt/themes

But I've found another drowbacks in my approach:
1. host with ansible MUST have connection to the container itself (as synchronize launches rsync from ansible host). For example, we in production had access only to lxc hosts via management network (and surprisingly that worked).
2. If you have non-standart SSH port on hosts (i.e. ansible-port is set), synchronize will fail as well, as containers are created with default ssh port (22). As a workaround dest_port: 22 might be hardcoded in synchronize task (unless lxc containers' SSH configuration won't rely on ansible_port variable)

So, maybe it's worth considering to use unarchive instead, just to be sure, that we have directory for our custom theme, like this (this should be enough for collectstatic task not to fail):
- file:
    path: "{{ horizon_lib_dir }}/openstack_dashboard/{{ item.value.theme_path }}"
    state: directory
    mode: 0755
    owner: "{{ horizon_system_user_name }}"
    group: "{{ horizon_system_group_name }}"
  with_dict: "{{ horizon_custom_themes }}"
  when: horizon_custom_themes is defined

Nevertheless, implementing change just to create a directory for themes will make people with custom themes finding the way to place their themes to containers by themselves, so first approach (with synchronize) seems a bit more universal and useful. Also it makes possible to automate theme delivery in case of it's update.