From 0fa5b5942826a4d17f18b416f371cbb792606bd9 Mon Sep 17 00:00:00 2001 From: Andy McCrae Date: Thu, 8 Jun 2017 16:20:29 +0100 Subject: [PATCH] Add Translations update steps. To facilitiate a translations check site this patch enables the ability to perform a pull_catalog and compilemessages, which will update the translations site. By default this won't run at all. Change-Id: Ib9b527d60226d3133206675b394d83f1185631b2 --- defaults/main.yml | 5 +++ .../update_translations-f950283d821bba05.yaml | 8 +++++ tasks/horizon_translations_update.yml | 31 +++++++++++++++++++ tasks/main.yml | 5 +++ 4 files changed, 49 insertions(+) create mode 100644 releasenotes/notes/update_translations-f950283d821bba05.yaml create mode 100644 tasks/horizon_translations_update.yml diff --git a/defaults/main.yml b/defaults/main.yml index 8bfae615..db1132c2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -291,6 +291,11 @@ horizon_pip_packages: # that could be needed for additional dashboards horizon_optional_pip_packages: [] +# This variable is used to update the horizon translations from +# Zanata, this can be set to "True" when testing translations, +# but should otherwise be left as False. +horizon_translations_update: False + # This variable is used by the repo_build process to determine # which host group to check for members of before building the # pip packages required by this role. The value is picked up diff --git a/releasenotes/notes/update_translations-f950283d821bba05.yaml b/releasenotes/notes/update_translations-f950283d821bba05.yaml new file mode 100644 index 00000000..284e6ecc --- /dev/null +++ b/releasenotes/notes/update_translations-f950283d821bba05.yaml @@ -0,0 +1,8 @@ +--- +features: + - You can force update the translations direct + from Zanata by setting ``horizon_translations_update`` + to ``True``. This will call the ``pull_catalog`` + option built into ``horizon-manage.py``. You should + only use this when testing translations, otherwise + this should remain set to the default of ``False``. diff --git a/tasks/horizon_translations_update.yml b/tasks/horizon_translations_update.yml new file mode 100644 index 00000000..0af424b2 --- /dev/null +++ b/tasks/horizon_translations_update.yml @@ -0,0 +1,31 @@ +--- +# Copyright 2017, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Perform a Horizon Zanata Pull Catalog + command: "{{ horizon_bin }}/horizon-manage.py pull_catalog" + args: + chdir: "{{ horizon_lib_dir }}/" + changed_when: false + +- name: Perform Horizon Zanata Compile Messages + command: "{{ horizon_bin }}/horizon-manage.py compilemessages" + args: + chdir: "{{ horizon_lib_dir }}/{{ item }}" + with_items: + - horizon + - openstack_dashboard + tags: + - skip_ansible_lint + notify: Restart apache2 diff --git a/tasks/main.yml b/tasks/main.yml index fb0a567c..89f908e8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -100,5 +100,10 @@ tags: - horizon-config +- include: horizon_translations_update.yml + when: horizon_translations_update | bool + tags: + - horizon-translations-update + - name: Flush handlers meta: flush_handlers