Add flush statements to get the logs moving.
This commit is contained in:
parent
45cb118faf
commit
8b51592cf2
1 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,7 @@ import getpass
|
||||||
import smtplib
|
import smtplib
|
||||||
import requests
|
import requests
|
||||||
import operator
|
import operator
|
||||||
|
import sys
|
||||||
|
|
||||||
# This is a flag used to turn off email to the actual users
|
# This is a flag used to turn off email to the actual users
|
||||||
DEVELOPMENT = False
|
DEVELOPMENT = False
|
||||||
|
@ -118,6 +119,7 @@ def to_address(user):
|
||||||
def send_email(user, last_change):
|
def send_email(user, last_change):
|
||||||
print "send an email to %r since they last changed on %r" % (
|
print "send an email to %r since they last changed on %r" % (
|
||||||
user, last_change.format('YYYY-MM-DD'))
|
user, last_change.format('YYYY-MM-DD'))
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
message = email.Message.Message()
|
message = email.Message.Message()
|
||||||
message.add_header('To', to_address(user))
|
message.add_header('To', to_address(user))
|
||||||
|
@ -143,10 +145,13 @@ def send_email(user, last_change):
|
||||||
|
|
||||||
def main(credentials):
|
def main(credentials):
|
||||||
print "* Querying FAS for a list of users"
|
print "* Querying FAS for a list of users"
|
||||||
|
sys.stdout.flush()
|
||||||
users = fedora_users(credentials)
|
users = fedora_users(credentials)
|
||||||
print "* Found %r people" % len(users)
|
print "* Found %r people" % len(users)
|
||||||
|
sys.stdout.flush()
|
||||||
for user in sorted(users, key=operator.itemgetter('username')):
|
for user in sorted(users, key=operator.itemgetter('username')):
|
||||||
#print "* Querying datagrepper for %r." % user['username'],
|
#print "* Querying datagrepper for %r." % user['username'],
|
||||||
|
#sys.stdout.flush()
|
||||||
changes = cert_changes(user['username'])
|
changes = cert_changes(user['username'])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -154,10 +159,12 @@ def main(credentials):
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
# Then the user has no changes in the fedmsg history.
|
# Then the user has no changes in the fedmsg history.
|
||||||
#print "No record of %r changing a cert." % user['username']
|
#print "No record of %r changing a cert." % user['username']
|
||||||
|
#sys.stdout.flush()
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print user['username'], "changed", latest.humanize(),
|
print user['username'], "changed", latest.humanize(),
|
||||||
print "on", latest.format('YYYY-MM-DD')
|
print "on", latest.format('YYYY-MM-DD')
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
delta = total_seconds(now - latest)
|
delta = total_seconds(now - latest)
|
||||||
if delta >= window_min and delta <= window_max:
|
if delta >= window_min and delta <= window_max:
|
||||||
|
@ -170,6 +177,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
if 'fas_credentials' not in config:
|
if 'fas_credentials' not in config:
|
||||||
print "No 'fas_credentials' found in `fedmsg-config`..."
|
print "No 'fas_credentials' found in `fedmsg-config`..."
|
||||||
|
sys.stdout.flush()
|
||||||
username = raw_input("Enter your fas username: ")
|
username = raw_input("Enter your fas username: ")
|
||||||
password = getpass.getpass("Enter your fas password: ")
|
password = getpass.getpass("Enter your fas password: ")
|
||||||
config['fas_credentials'] = dict(username=username, password=password)
|
config['fas_credentials'] = dict(username=username, password=password)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue