Moved compilemessages to handlers

As there were 2 compilemessages tasks in different places and one of
them was executed on every launch, in order to remove dublicated code
and ease it's maintenance, this task was moved to handlers.

Change-Id: Ic9c0de9248c8bd3cd796aa2a338cc57afba57446
This commit is contained in:
Dmitriy Rabotjagov 2019-02-28 11:42:47 +02:00
parent 2ec8ff4a5c
commit 60ae573179
6 changed files with 19 additions and 38 deletions

View File

@ -13,6 +13,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Compile messages
command: "{{ horizon_manage }} compilemessages"
become: yes
become_user: "{{ horizon_system_user_name }}"
args:
chdir: "{{ horizon_lib_dir }}/"
listen:
- "venv changed"
- name: Restart apache2
service:
name: "{{ horizon_system_service_name }}"

View File

@ -59,6 +59,9 @@
until: install_packages is success
retries: 5
delay: 2
notify:
- Compile messages
- Restart apache2
- name: Install horizon packages from PIP
include_tasks: horizon_install_source.yml

View File

@ -139,4 +139,6 @@
path: "{{ horizon_dashboard_panel_dir }}/{{ item.path|basename }}"
state: link
with_items: "{{ found_panels.files }}"
notify: Restart apache2
notify:
- Compile messages
- Restart apache2

View File

@ -107,20 +107,6 @@
when: item.value.theme_src_archive is defined
notify: Restart apache2
- name: Compile messages for translation
command: "{{ horizon_manage }} compilemessages"
become: yes
become_user: "{{ horizon_system_user_name }}"
args:
chdir: "{{ item }}"
changed_when: false
with_items:
- "{{ horizon_python_lib_dir }}/horizon"
- "{{ horizon_lib_dir }}/openstack_dashboard"
register: async_compile_messages
async: 600
poll: 0
- name: Collect and compress static files
command: "{{ item }}"
become: yes

View File

@ -14,20 +14,14 @@
# limitations under the License.
- name: Perform a Zanata Pull Catalog
command: "{{ horizon_bin }}/horizon-manage.py pull_catalog -p {{ translation.project }} -m {{ translation.module }} -b {{ (translation.branch | default(horizon_translations_project_version)) | replace('/', '-') }}"
command: "{{ horizon_manage }} pull_catalog -p {{ translation.project }} -m {{ translation.module }} -b {{ (translation.branch | default(horizon_translations_project_version)) | replace('/', '-') }}"
args:
chdir: "{{ horizon_lib_dir }}/"
changed_when: false
with_items: "{{ horizon_translations_pull }}"
loop_control:
loop_var: translation
when:
- translation.enabled | bool
- name: Perform Zanata Compile Messages
command: "{{ horizon_bin }}/horizon-manage.py compilemessages"
args:
chdir: "{{ horizon_lib_dir }}/"
tags:
- skip_ansible_lint
notify: Restart apache2
notify:
- Compile messages
- Restart apache2

View File

@ -85,19 +85,6 @@
tags:
- horizon-config
- name: Ensure messages are compiled for translation
async_status:
jid: "{{ item.ansible_job_id }}"
become: yes
become_user: "{{ horizon_system_user_name }}"
register: async_compile_messages_check
until: async_compile_messages_check.finished
retries: 300
with_items:
- "{{ async_compile_messages.results }}"
tags:
- horizon-config
# NOTE(mhayden): The async_status check here must be done as the horizon user
# since the original task ran as that user. This task will fail if it is run
# as root because the async status file is within the horizon user's home