From 0dc6cadee3e5c6ac2f701f12fe2f27dfd27d4c98 Mon Sep 17 00:00:00 2001 From: Amir Sarabadani Date: Sat, 11 Jul 2020 14:27:30 +0200 Subject: [PATCH] Fixes for new wiki handler - Adding more debug stuff so we know what's going on - Making the cron work 4 times a day instead of one --- cron | 2 +- new_wikis_handler.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cron b/cron index 509e61f..22ce603 100755 --- a/cron +++ b/cron @@ -1,4 +1,4 @@ 15 * * * * jsub -once -N column_mover python3 /data/project/phabbot/phabbot/column_mover.py /data/project/phabbot/phabbot/creds.json 3600 >/dev/null 2>&1 10 * * * * jsub -once -N patch_for_review python3 /data/project/phabbot/phabbot/patchforreview_remover.py /data/project/phabbot/phabbot/creds.json 3600 >/dev/null 2>&1 5 * * * * jlocal bash /data/project/phabbot/phabbot/updater.sh >/dev/null 2>&1 -10 22 * * * jsub -once -N new_wikis_handler python3 /data/project/phabbot/phabbot/new_wikis_handler.py /data/project/phabbot/phabbot/creds.json 10000000 >/dev/null 2>&1 \ No newline at end of file +10 22,4,10,16 * * * jsub -once -N new_wikis_handler python3 /data/project/phabbot/phabbot/new_wikis_handler.py /data/project/phabbot/phabbot/creds.json 10000000 >/dev/null 2>&1 diff --git a/new_wikis_handler.py b/new_wikis_handler.py index c83e5a7..e17a815 100644 --- a/new_wikis_handler.py +++ b/new_wikis_handler.py @@ -65,18 +65,22 @@ def create_apache_config_subticket(parts, task_details): def hande_task(phid): global final_text final_text = '' - add_text('\n\n------\n**Pre-install automatic checklist:**') task_details = client.taskDetails(phid) + print('Checking', task_details['id']) + add_text('\n\n------\n**Pre-install automatic checklist:**') language_code = re.findall(r'\n- *?\*\*Language code:\*\* *?(\S+)', task_details['description']) if not language_code: + print('lang code not found, skipping') return language_code = language_code[0] url = re.findall(r'\n- *?\*\*Site URL:\*\* *?(\S+)', task_details['description']) if not url: + print('url not found, skipping') return url = url[0] parts = url.split('.') if len(parts) != 3 or parts[2] != 'org': + print('the url looks weird, skipping') return special = parts[1] == 'wikimedia' @@ -133,7 +137,6 @@ def hande_task(phid): else: core_lang = False add_text(' [] [[{}|Language configuration in mediawiki core]]'.format(core_messages_url)) - path = 'mediawiki/extensions/WikimediaMessages/+/master/i18n/wikimediaprojectnames/en.json' wikimedia_messages_data = get_file_from_gerrit(path) wikimedia_messages_data = json.loads(wikimedia_messages_data)