]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/mass_migrate.py
Implement 'append-by-default' reports, --redo for mass-upgrade.
[wizard.git] / wizard / command / mass_migrate.py
index 04ea06f934591eea1d8bf252aa1c653cb00f9db0..200743052c4b4f75efb57e42bdede0fb88eedeb4 100644 (file)
@@ -16,9 +16,10 @@ def main(argv, baton):
     app = args[0]
     base_args = calculate_base_args(options)
     sh = shell.ParallelShell.make(options.no_parallelize, options.max_processes)
+    command.create_logdir(options.log_dir)
     seen = sset.make(options.seen)
     is_root = not os.getuid()
-    warnings_log, errors_log = command.open_logs(options.log_dir)
+    report = command.open_reports(options.log_dir)
     # loop stuff
     errors = {}
     i = 0
@@ -34,14 +35,14 @@ def main(argv, baton):
         child_args = list(base_args)
         # calculate the log file, if a log dir was specified
         if options.log_dir:
-            log_file = command.calculate_log_name(options.log_dir, i, d.location)
+            log_file = command.calculate_log_name(options.log_dir, i)
             child_args.append("--log-file=" + log_file)
         # actual meat
         def make_on_pair(d, i):
             # we need to make another stack frame so that d and i get specific bindings.
             def on_success(stdout, stderr):
                 if stderr:
-                    warnings_log.write("%s\n" % d.location)
+                    report.warnings.write("%s\n" % d.location)
                     logging.warning("Warnings [%04d] %s:\n%s" % (i, d.location, stderr))
                 seen.add(d.location)
             def on_error(e):
@@ -54,7 +55,7 @@ def main(argv, baton):
                     if name not in errors: errors[name] = []
                     errors[name].append(d)
                     logging.error("%s in [%04d] %s" % (name, i, d.location))
-                    errors_log.write("%s\n" % d.location)
+                    report.errors.write("%s\n" % d.location)
             return (on_success, on_error)
         on_success, on_error = make_on_pair(d, i)
         sh.call("wizard", "migrate", d.location, *child_args,
@@ -89,8 +90,6 @@ the scripts AFS patch."""
         parser.error("too many arguments")
     elif not args:
         parser.error("must specify application to migrate")
-    if options.dry_run:
-        options.no_parallelize = True
     return options, args
 
 def calculate_base_args(options):