]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/mass_migrate.py
Fix exceptions, quiet subprocesses, change logging and order.
[wizard.git] / wizard / command / mass_migrate.py
index def06fcba28c9d3a56c48936c04306f22a17a0dd..670b6a064fcef802949410a30661bb654c0f765d 100644 (file)
@@ -51,14 +51,14 @@ def main(argv, baton):
             if not real.startswith(pwd.getpwuid(uid).pw_dir + "/"):
                 logging.error("Security check failed, owner of deployment and owner of home directory mismatch for %s" % d.location)
                 continue
-        # calculate the log file, if a log dir was specified
-        if options.log_dir:
-            log_file = os.path.join(options.log_dir, shorten(d.location))
-            child_args.append("--log-file=" + log_file)
         # check if we want to punt due to --limit
         i += 1
-        if i > options.limit:
+        if options.limit and i > options.limit:
             break
+        # calculate the log file, if a log dir was specified
+        if options.log_dir:
+            log_file = os.path.join(options.log_dir, shorten(i, d.location))
+            child_args.append("--log-file=" + log_file)
         # actual meat
         def make_on_pair(d):
             def on_success(stdout, stderr):
@@ -125,11 +125,11 @@ untrusted repositories."""
 
 def calculate_base_args(options):
     base_args = command.makeBaseArgs(options, dry_run="--dry-run", srv_path="--srv-path", force="--force")
+    base_args += '--quiet'
     return base_args
 
-def shorten(dir):
-    hash = hashlib.sha1(dir).hexdigest()[0:7]
-    return hash + dir.replace('/', '~')
+def shorten(i, dir):
+    return "%04d" % i + dir.replace('/', '-') + ".log"
 
 def make_shell(options):
     if options.no_parallelize: