mirror of
https://gitlab.wikimedia.org/ladsgroup/Phabricator-maintenance-bot
synced 2024-11-08 21:22:38 +01:00
More improvements on new wikis handler
Preparing for the part of creating parent tasks.
This commit is contained in:
parent
501463b05c
commit
0c97322d2e
2 changed files with 28 additions and 12 deletions
10
lib.py
10
lib.py
|
@ -186,3 +186,13 @@ class Client(object):
|
||||||
}
|
}
|
||||||
return self.post('maniphest.search', params)[
|
return self.post('maniphest.search', params)[
|
||||||
'data']
|
'data']
|
||||||
|
|
||||||
|
def getTaskParents(self, phid):
|
||||||
|
params = {
|
||||||
|
"constraints": {
|
||||||
|
"phids": [phid],
|
||||||
|
"hasParents": True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self.post('maniphest.search', params)[
|
||||||
|
'data']
|
|
@ -54,13 +54,17 @@ def hostname_resolves(hostname):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def handle_restbase(url):
|
def handle_restbase(url, phid):
|
||||||
path = get_gerrit_path(
|
path = get_gerrit_path(
|
||||||
'mediawiki/services/restbase/deploy',
|
'mediawiki/services/restbase/deploy',
|
||||||
'scap/vars.yaml'
|
'scap/vars.yaml'
|
||||||
)
|
)
|
||||||
restbase = get_file_from_gerrit(path)
|
restbase = get_file_from_gerrit(path)
|
||||||
add_checklist(gerrit_path + path, 'RESTbase', url in restbase)
|
add_checklist(gerrit_path + path, 'RESTbase', url in restbase)
|
||||||
|
if url not in restbase:
|
||||||
|
print(client.getTaskParents(phid))
|
||||||
|
import sys
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def handle_cx(language_code, bug_id):
|
def handle_cx(language_code, bug_id):
|
||||||
|
@ -80,7 +84,7 @@ def handle_cx(language_code, bug_id):
|
||||||
b = json.loads('\n'.join(r.text.split('\n')[1:]))
|
b = json.loads('\n'.join(r.text.split('\n')[1:]))
|
||||||
if b:
|
if b:
|
||||||
return
|
return
|
||||||
maker = CxPatchMaker(lang, bug_id)
|
maker = CxPatchMaker(language_code, bug_id)
|
||||||
maker.run()
|
maker.run()
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +143,7 @@ def post_a_comment(comment):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def handle_subticket_for_cloud(task_details, db_name, wiki_status="unknown"):
|
def handle_subticket_for_cloud(task_details, db_name, wiki_status):
|
||||||
hasSubtasks = client.getTaskSubtasks(task_details['phid'])
|
hasSubtasks = client.getTaskSubtasks(task_details['phid'])
|
||||||
if hasSubtasks:
|
if hasSubtasks:
|
||||||
return
|
return
|
||||||
|
@ -414,6 +418,7 @@ def hande_task(task_details):
|
||||||
return
|
return
|
||||||
db_name = get_db_name(wiki_spec, parts)
|
db_name = get_db_name(wiki_spec, parts)
|
||||||
shard = wiki_spec.get('Shard', 'TBD')
|
shard = wiki_spec.get('Shard', 'TBD')
|
||||||
|
visibility = wiki_spec.get('Visibility', 'unknown')
|
||||||
shardDecided = shard != "TBD"
|
shardDecided = shard != "TBD"
|
||||||
special = parts[1] == 'wikimedia'
|
special = parts[1] == 'wikimedia'
|
||||||
|
|
||||||
|
@ -424,7 +429,7 @@ def hande_task(task_details):
|
||||||
add_text(' [] #DBA decided about the shard')
|
add_text(' [] #DBA decided about the shard')
|
||||||
dns = handle_dns(special, url, language_code, task_tid)
|
dns = handle_dns(special, url, language_code, task_tid)
|
||||||
if not special and wiki_spec.get('Special', '').lower() != 'yes':
|
if not special and wiki_spec.get('Special', '').lower() != 'yes':
|
||||||
handle_subticket_for_cloud(task_details, db_name)
|
handle_subticket_for_cloud(task_details, db_name, visibility)
|
||||||
apache = handle_apache(special, parts)
|
apache = handle_apache(special, parts)
|
||||||
langdb = handle_langdb(language_code)
|
langdb = handle_langdb(language_code)
|
||||||
core_lang = handle_core_lang(language_code)
|
core_lang = handle_core_lang(language_code)
|
||||||
|
@ -439,8 +444,9 @@ def hande_task(task_details):
|
||||||
else:
|
else:
|
||||||
add_text('**The creation is blocked until these part are all done.**')
|
add_text('**The creation is blocked until these part are all done.**')
|
||||||
|
|
||||||
|
if visibility.lower() != 'private':
|
||||||
add_text('\n-------\n**Post install automatic checklist:**')
|
add_text('\n-------\n**Post install automatic checklist:**')
|
||||||
handle_restbase(url)
|
handle_restbase(url, task_details['phid'])
|
||||||
handle_cx(language_code, task_tid)
|
handle_cx(language_code, task_tid)
|
||||||
handle_analytics('.'.join(parts[:2]), task_tid)
|
handle_analytics('.'.join(parts[:2]), task_tid)
|
||||||
handle_pywikibot(parts[1], language_code)
|
handle_pywikibot(parts[1], language_code)
|
||||||
|
|
Loading…
Reference in a new issue