Volans has uploaded a new change for review.
https://gerrit.wikimedia.org/r/317119
Change subject: wmf-auto-reimage: improve messaging
......................................................................
wmf-auto-reimage: improve messaging
Bug: T148815
Change-Id: I597872c935a84b5fbf3db957775f4e6b9d47d903
---
M modules/salt/files/wmf_auto_reimage.py
1 file changed, 30 insertions(+), 10 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/puppet
refs/changes/19/317119/1
diff --git a/modules/salt/files/wmf_auto_reimage.py
b/modules/salt/files/wmf_auto_reimage.py
index b3bb000..2686ae1 100644
--- a/modules/salt/files/wmf_auto_reimage.py
+++ b/modules/salt/files/wmf_auto_reimage.py
@@ -33,9 +33,9 @@
PHAB_COMMENT_PRE = ('Script wmf_auto_reimage was launched by {user} on '
'{hostname} for hosts:\n```\n{hosts}\n```\n'
'The log can be found in `{log}`.')
-PHAB_COMMENT_POST = ('Completed auto-reimage of hosts:\n```\n{hosts}\n```\n'
- 'Those hosts were successful:\n```\n{successful}\n```\n'
- '{notes}')
+PHAB_COMMENT_POST = 'Completed auto-reimage of hosts:\n```\n{hosts}\n```\n'
+PHAB_COMMENT_POST_SUCCESS = 'and were **ALL** successful.\n'
+PHAB_COMMENT_POST_FAILED = 'Of which those **FAILED**:\n```\n{failed}\n```\n'
WATCHER_SLEEP_THRESHOLD = 10 # Use the WATCHER_LONG_SLEEP after those loops
@@ -939,6 +939,27 @@
return message
+def get_phabricator_post_message(hosts, successful, hosts_status=None):
+ hosts_set = set(hosts)
+ successful_set = set(successful)
+ failed = hosts_set - successful_set
+
+ if failed:
+ result = PHAB_COMMENT_POST_FAILED.format(failed=failed)
+ else:
+ result = PHAB_COMMENT_POST_SUCCESS
+
+ notes = ''
+ if hosts_status is not None:
+ notes = get_repool_message(hosts_status)
+
+ message = '{common}\n{result}\n{notes}'.format(
+ common=PHAB_COMMENT_POST.format(hosts=hosts),
+ result=result, notes=notes)
+
+ return message
+
+
def run(args, user, log_path):
""" Run the WMF auto reimage according to command line arguments
@@ -955,6 +976,7 @@
deployment_host = resolve_dns(DEPLOYMENT_DOMAIN, 'CNAME')
phab_client = get_phabricator_client()
hosts = args.hosts
+ hosts_status = None
# Validate hosts
validate_hosts(puppetmaster_host, args.hosts, args.no_verify)
@@ -1005,17 +1027,15 @@
if args.apache:
hosts = run_apache_fast_test(deployment_host, hosts)
- # Repool (manually for now)
- notes = ''
- if args.conftool:
- notes = get_repool_message(hosts_status)
+ # The repool is *not* done automatically the command to repool is added
+ # to the Phabricator task
# Comment on the Phabricator task
if args.phab_task_id is not None:
+ phabricator_message = get_phabricator_post_message(
+ args.hosts, hosts, hosts_status=hosts_status)
phabricator_task_update(
- phab_client, args.phab_task_id,
- PHAB_COMMENT_POST.format(
- hosts=args.hosts, successful=hosts, notes=notes))
+ phab_client, args.phab_task_id, phabricator_message)
logger.info(("Auto reimaging of hosts '{hosts}' completed, hosts "
"'{successful}' were successful.").format(
--
To view, visit https://gerrit.wikimedia.org/r/317119
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I597872c935a84b5fbf3db957775f4e6b9d47d903
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Volans <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits