From 8b51592cf2766a2e3b592a9c775c9e89c2a906fc Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 17 Sep 2015 18:48:10 +0000 Subject: [PATCH] Add flush statements to get the logs moving. --- roles/koji_reminder/files/koji-cert-reminder.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/koji_reminder/files/koji-cert-reminder.py b/roles/koji_reminder/files/koji-cert-reminder.py index 443eaea83f..b459cd0468 100644 --- a/roles/koji_reminder/files/koji-cert-reminder.py +++ b/roles/koji_reminder/files/koji-cert-reminder.py @@ -20,6 +20,7 @@ import getpass import smtplib import requests import operator +import sys # This is a flag used to turn off email to the actual users DEVELOPMENT = False @@ -118,6 +119,7 @@ def to_address(user): def send_email(user, last_change): print "send an email to %r since they last changed on %r" % ( user, last_change.format('YYYY-MM-DD')) + sys.stdout.flush() message = email.Message.Message() message.add_header('To', to_address(user)) @@ -143,10 +145,13 @@ def send_email(user, last_change): def main(credentials): print "* Querying FAS for a list of users" + sys.stdout.flush() users = fedora_users(credentials) print "* Found %r people" % len(users) + sys.stdout.flush() for user in sorted(users, key=operator.itemgetter('username')): #print "* Querying datagrepper for %r." % user['username'], + #sys.stdout.flush() changes = cert_changes(user['username']) try: @@ -154,10 +159,12 @@ def main(credentials): except StopIteration: # Then the user has no changes in the fedmsg history. #print "No record of %r changing a cert." % user['username'] + #sys.stdout.flush() continue print user['username'], "changed", latest.humanize(), print "on", latest.format('YYYY-MM-DD') + sys.stdout.flush() delta = total_seconds(now - latest) if delta >= window_min and delta <= window_max: @@ -170,6 +177,7 @@ if __name__ == '__main__': if 'fas_credentials' not in config: print "No 'fas_credentials' found in `fedmsg-config`..." + sys.stdout.flush() username = raw_input("Enter your fas username: ") password = getpass.getpass("Enter your fas password: ") config['fas_credentials'] = dict(username=username, password=password)