Vishnu Sreekumar has uploaded a new change for review. Change subject: Any patch with no activity for 30 days send an email to author and cc all parties. If author not from RedHat cc iheim@ and bazulay@ by default. ......................................................................
Any patch with no activity for 30 days send an email to author and cc all parties. If author not from RedHat cc iheim@ and bazulay@ by default. Any patch with no activity for 60 days abandoned with comment "Abandoned due to no activity - please restore if still relevant". Usage: alert_old_patches.py [-h] [--server SERVER] [--port PORT] [--user USER] [--key KEY] [--mail MAIL] [--cc CC [CC ...]] [--warning-days-limit WARNING_DAYS] [--abandon-days-limit ABANDON_DAYS] [--dry-run] projects [projects ...] Positional arguments: projects List of projects Optional arguments: --server SERVER Gerrit server, default: gerrit.ovirt.org --port PORT SSH Port,default: 29418 --user USER SSH User, default: $USER --key KEY SSH Key file path --mail MAIL Mail server, default: localhost --warning-days-limit WARNING_DAYS Number of days, default: 30 --abandon-days-limit ABANDON_DAYS Number of days, default 60 --dry-run Dry run --cc CC [CC ...] CC mail id's for non-redhat emails, default iheim@, bazulay@ Example: alert_old_patches.py vdsm ovirt-engine alert_old_patches.py --user alice --key ~/alice_rsa vdsm ovirt-engine Changelog: Use a global variable for the ssh command + common options. Updated all the email addresses as given in Code-review-1. Use argparse for command line options. Print return code, error and output on failures. Fixed the formatting issues with print statements. Removed all un-used global variable declarations. Specified exception type in except statements. Removed heading and trailing white spaces from doc string. Fixed all the issues given in Code-review-7. Updated the module docstring explaining what the script does. Use lowercase names for non-constant variables. Send email to owner for abandoned patches. Add an option for dry run. Add command line options to specify warning and abandon days limit. Convert the number of days to integer before parsing. Do not open connection to mailserver in dry-run mode. Change-Id: Ia78a78de0cebb60be53b6c97ae272fef8c24c46c Signed-off-by: Vishnu Sreekumar <vishnu.sr...@gmail.com> --- M scripts/alert_old_patches.py 1 file changed, 11 insertions(+), 6 deletions(-) git pull ssh://gerrit.ovirt.org:29418/jenkins refs/changes/45/42445/1 diff --git a/scripts/alert_old_patches.py b/scripts/alert_old_patches.py index 73abe1b..721a2ae 100755 --- a/scripts/alert_old_patches.py +++ b/scripts/alert_old_patches.py @@ -30,7 +30,7 @@ "Return list of commits inactive for the given days." gerrit_call = ( "%s gerrit query --format=JSON status:open " - "--dependencies age:%sd project:%s" + "--dependencies age:%dd project:%s" ) % (SSH, days, t_project) shell_command = ["bash", "-c", gerrit_call] shell_output = log_exec(shell_command) @@ -114,10 +114,10 @@ nargs='+') parser.add_argument( "--warning-days-limit", help="Number of days, default: 30", - default=30, dest='warning_days') + default="30", dest='warning_days') parser.add_argument( "--abandon-days-limit", help="Number of days, default 60", - default=60, dest='abandon_days') + default="60", dest='abandon_days') parser.add_argument( "--dry-run", help="Show what would have been abandoned", action="store_true", dest='dry_run') @@ -133,7 +133,11 @@ MAIL_SERVER_HOST = ARGS.mail SUBJECT = "Forgotten Patches" - MAILSERVER = smtplib.SMTP(MAIL_SERVER_HOST) + if not ARGS.dry_run: + MAILSERVER = smtplib.SMTP(MAIL_SERVER_HOST) + else: + MAILSERVER = None + FROMADDR = "noreply+patchwatc...@ovirt.org" if ARGS.cc: CCADDR = ",".join(ARGS.cc) @@ -141,7 +145,7 @@ CCADDR = CC_EMAIL patches = [] - DAYS = [ARGS.abandon_days, ARGS.warning_days] + DAYS = [int(ARGS.abandon_days), int(ARGS.warning_days)] WARN_TEMPLATE = ( "Your patch did not have any activity for over 30 days, " "please consider nudging for more attention." @@ -194,4 +198,5 @@ print( "%s would have been emailed to nudge patch %s" % (owner['email'], patch)) - MAILSERVER.quit() + if MAILSERVER: + MAILSERVER.quit() -- To view, visit https://gerrit.ovirt.org/42445 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia78a78de0cebb60be53b6c97ae272fef8c24c46c Gerrit-PatchSet: 1 Gerrit-Project: jenkins Gerrit-Branch: master Gerrit-Owner: Vishnu Sreekumar <vishnu.sr...@gmail.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches