From 135fb6a31aa1f320f2b5e0830b33f2e4e1206551 Mon Sep 17 00:00:00 2001
From: Andreas Jaeger <aj@suse.com>
Date: Fri, 9 Nov 2018 16:20:02 +0100
Subject: [PATCH] Handle operations-guide and contributor-guide

Documentation projects are whitelisted. Since operations-guide and
contributor-guide has a normal "doc/source" setup, we can use the
generic handling of this and just extend the whitelist.
Instead of having the whiteliste in two places, move it in a central
shared place.

This will handle operations-guide and contributor-guide the same way
as horizon, openstack-ansible, and openstack-helm.

Change-Id: Ie1065b7d4ad47dee738568c70df28a5cdaa6f6f7
---
 .../files/common_translation_update.sh                    | 8 ++++++++
 .../files/propose_translation_update.sh                   | 4 ++--
 .../files/upstream_translation_update.sh                  | 3 +--
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/roles/prepare-zanata-client/files/common_translation_update.sh b/roles/prepare-zanata-client/files/common_translation_update.sh
index 8c0a37e4..818bcced 100644
--- a/roles/prepare-zanata-client/files/common_translation_update.sh
+++ b/roles/prepare-zanata-client/files/common_translation_update.sh
@@ -36,6 +36,14 @@ INVALID_PO_FILE=0
 # set to 0 on successful run.
 ERROR_ABORT=1
 
+# List of repos that have doc/source translated, we test with a smaller
+# set for now.
+DOC_TARGETS=('contributor-guide'
+             'horizon'
+             'openstack-ansible'
+             'openstack-helm'
+             'operations-guide')
+
 # We need a UTF-8 locale, set it properly in case it's not set.
 export LANG=en_US.UTF-8
 
diff --git a/roles/prepare-zanata-client/files/propose_translation_update.sh b/roles/prepare-zanata-client/files/propose_translation_update.sh
index 41cafa87..3c64d49c 100755
--- a/roles/prepare-zanata-client/files/propose_translation_update.sh
+++ b/roles/prepare-zanata-client/files/propose_translation_update.sh
@@ -176,8 +176,8 @@ function handle_python_django_project {
 # Handle project doc proposals
 function handle_project_doc {
     local project=$1
-    # doing only things in the test repos for project doc translation
-    if ! [[ "$project" =~ ^(horizon|openstack-ansible|openstack-helm)$ ]]; then
+    # Doing only things in the test repos for project doc translation
+    if ! [[ ${DOC_TARGETS[*]} =~ "$project" ]]; then
         return
     fi
     # setup_project and pull_from_zanata are already done
diff --git a/roles/prepare-zanata-client/files/upstream_translation_update.sh b/roles/prepare-zanata-client/files/upstream_translation_update.sh
index 5416032a..60b98111 100755
--- a/roles/prepare-zanata-client/files/upstream_translation_update.sh
+++ b/roles/prepare-zanata-client/files/upstream_translation_update.sh
@@ -115,9 +115,8 @@ case "$PROJECT" in
             done
         fi
         # ---- Documentation ----
-        # Let's test this with some repos :)
-        DOC_TARGETS=('horizon' 'openstack-ansible' 'openstack-helm')
         if [[ -f doc/source/conf.py ]]; then
+            # Let's test this with some repos :)
             if [[ ${DOC_TARGETS[*]} =~ "$PROJECT" ]]; then
                 extract_messages_doc
                 ALL_MODULES="doc $ALL_MODULES"