]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/mass_upgrade.py
Fix bug where php.ini not being rewritten for MediaWiki.
[wizard.git] / wizard / command / mass_upgrade.py
index 0afdffdefe48ec9ab70437bcdfb1bb3925b97af4..154455f190a6e7a672549fb0a38a96be9e83f92f 100644 (file)
@@ -6,7 +6,7 @@ import sys
 import shutil
 import errno
 
-from wizard import deploy, report, scripts, shell, sset, command
+from wizard import deploy, report, shell, sset, command
 from wizard.command import upgrade
 
 def main(argv, baton):
@@ -16,12 +16,15 @@ def main(argv, baton):
     command.create_logdir(options.log_dir)
     # setup reports
     human_status = {
-        'up_to_date': 'were up-to-date',
+        'up_to_date': 'are now up-to-date',
         'not_migrated': 'were not migrated',
         'merge': 'had merge failures',
         'verify': 'had web verification errors',
         'backup_failure': 'had a backup failure',
         'blacklisted': 'were blacklisted',
+        'db': 'had database errors',
+        'quota': 'had too low quota',
+        'permissions': 'had insufficient permissions for upgrade'
     }
     if options.remerge:
         os.unlink(os.path.join(options.log_dir, 'merge.txt'))
@@ -98,12 +101,21 @@ def main(argv, baton):
                         # This should actually be a warning, but it's a really common error
                         logging.info("[%04d] Could not verify application at %s", i, url)
                         status.write("verify", i, url)
+                    elif e.name == "DatabaseVerificationError":
+                        logging.info("[%04d] Could not verify database ast %s", i, d.location)
+                        status.write("db", i, d.location)
                     elif e.name == "NotMigratedError":
                         logging.info("[%04d] Application not migrated at %s", i, d.location)
                         status.write("not_migrated", i, d.location)
                     elif e.name == "BackupFailure":
                         logging.info("[%04d] Failed backups at %s", i, d.location)
                         status.write("backup_failure", i, d.location)
+                    elif e.name == "QuotaTooLow":
+                        logging.info("[%04d] Quota too low at %s", i, d.location)
+                        status.write("quota", i, d.location)
+                    elif e.name == "PermissionsError":
+                        logging.info("[%04d] Insufficient permissions to upgrade %s", i, d.location)
+                        status.write("permissions", i, d.location)
                     else:
                         errors.setdefault(e.name, []).append(d)
                         logging.error("[%04d] %s in %s", i, e.name, d.location)
@@ -119,8 +131,9 @@ def main(argv, baton):
         for name, deploys in errors.items():
             logging.warning("%s from %d installs", name, len(deploys))
         print
+        total = sum(len(x.values) for x in status.reports.values())
         def printPercent(description, number):
-            print "% 4d out of % 4d installs (% 5.1f%%) %s" % (number, i, float(number)/i*100, description)
+            print "% 4d out of % 4d installs (% 5.1f%%) %s" % (number, total, float(number)/total*100, description)
         error_count = sum(len(e) for e in errors.values())
         if error_count:
             printPercent("had unusual errors", error_count)
@@ -128,14 +141,16 @@ def main(argv, baton):
             values = status.reports[name].values
             if values:
                 printPercent(description, len(values))
+        sys.stderr.write("\n")
+        print "%d installs were upgraded this run" % len(runtime.reports["success"].values)
 
 def parse_args(argv, baton):
     usage = """usage: %prog mass-upgrade [ARGS] APPLICATION
 
-Mass upgrades an application to the latest scripts version.
-Essentially equivalent to running '%prog upgrade' on all
-autoinstalls for a particular application found by parallel-find,
-but with advanced reporting.
+Mass upgrades an application to the latest version.  Essentially
+equivalent to running '%prog upgrade' on all autoinstalls for a
+particular application found by parallel-find, but with advanced
+reporting.
 
 This command is intended to be run as root on a server with
 the scripts AFS patch."""