]> scripts.mit.edu Git - wizard.git/commitdiff
Add success reporting.
authorEdward Z. Yang <ezyang@mit.edu>
Wed, 23 Dec 2009 19:13:22 +0000 (14:13 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Wed, 23 Dec 2009 19:13:22 +0000 (14:13 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
TODO
wizard/command/__init__.py
wizard/command/mass_upgrade.py

diff --git a/TODO b/TODO
index 9cb904aba40c72794b2def2fa6bff1ae777b9e32..26daf0e7ca240f777f5cc97e653853b07673a211 100644 (file)
--- a/TODO
+++ b/TODO
@@ -4,8 +4,6 @@ TODO NOW:
 
 - XXX: Upgrades don't pull updated tags, breaking git describe --tags!
   Fix this for the future, and figure out how to make everyone else happy!
-- XXX: Some installs are throwing spurious errors; investigate
-- XXX: Prolly would be nice to have some information about how many installs actually succeeded
 - If you try to do an install on scripts w/o sql, it will sign you up but fail to write
   the sql.cnf file. This sucks.
 
index e23603e146b9cbfb177ab50e5aaadae75809aeaa..fb8b45bd529c58d20d4d9d032798efca9ef0bb3a 100644 (file)
@@ -133,6 +133,8 @@ class Report(object):
     skip = None
     #: Dict of append names to counts.  You should manually increment these as necessary
     fails = None
+    #: Number of successes
+    successes = 0
     #: Names of the files objects
     names = None
     def __init__(self, names, fobjs, skip, fails):
index 1c4fd9a566c1de91199c3fa298b4e37e99e5a2fa..c4045aef508b8d29e9d0676caaca11884aa4db92 100644 (file)
@@ -16,7 +16,7 @@ def main(argv, baton):
     command.create_logdir(options.log_dir)
     seen = sset.make(options.seen)
     is_root = not os.getuid()
-    report = command.open_reports(options.log_dir, ('lookup', 'warnings', 'errors'),
+    report = command.open_reports(options.log_dir, ('lookup', 'warnings', 'errors', 'success'),
         options.redo, ('merge', 'verify', 'backup_failure', 'blacklisted'))
     # loop stuff
     errors = {}
@@ -57,6 +57,8 @@ def main(argv, baton):
                         report.lookup.write("[%04d] %s\n" % (i, d.location)) # pylint: disable-msg=E1101
                         logging.warning("[%04d] Warnings at [%s]:\n%s" % (i, d.location, stderr))
                     seen.add(d.location)
+                    report.success.write("%s\n")
+                    report.successes += 1
                     report.flush()
                 def on_error(e):
                     if e.name == "AlreadyUpgraded":
@@ -104,12 +106,14 @@ def main(argv, baton):
         sys.stderr.write("\n")
         for name, deploys in errors.items():
             logging.warning("%s from %d installs" % (name, len(deploys)))
+        print
         def printPercent(description, number, total):
-            logging.warning("%d out of %d installs (%.1f%%) had %s" % (number, total, float(number)/total*100, description))
+            print "%d out of %d installs (%.1f%%) had %s" % (number, total, float(number)/total*100, description)
         if report.fails['merge']:
             printPercent("merge conflicts", report.fails['merge'], i)
         if report.fails['verify']:
             printPercent("web verification failure", report.fails['verify'], i)
+        printPercent("successful upgrades", report.successes, i)
 
 def parse_args(argv, baton):
     usage = """usage: %prog mass-upgrade [ARGS] APPLICATION