]> scripts.mit.edu Git - wizard.git/commitdiff
Implement mass migrate.
authorEdward Z. Yang <edwardzyang@thewritingpot.com>
Wed, 17 Jun 2009 05:41:37 +0000 (01:41 -0400)
committerEdward Z. Yang <edwardzyang@thewritingpot.com>
Wed, 17 Jun 2009 05:41:37 +0000 (01:41 -0400)
Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
TODO
lib/wizard/__init__.py
lib/wizard/command/massmigrate.py
lib/wizard/command/migrate.py
lib/wizard/command/summary.py

diff --git a/TODO b/TODO
index 05284982688446a393c7a4f9c6733dc3e03ba340..284c08814f839ebe6e12a6e8f130613d166a27bb 100644 (file)
--- a/TODO
+++ b/TODO
@@ -21,6 +21,9 @@ NOTES:
   We will then nop update some installs, but this will prevent
   us from having to migrate and update concurrently.
 
+- summary and info are still not using loggers. Maybe they should,
+  maybe they shouldn't
+
 OVERALL PLAN:
 
 * Some parts of the infrastructure will not be touched, although I plan
index b0c216c4c1cc1d80f887717d4b29306663517e1b..309b86c700430ec51de9904da4a84152c89a576d 100644 (file)
@@ -31,4 +31,4 @@ class WizardOptionParser(optparse.OptionParser):
                 default=False, help="Turns on verbose output")
     def parse_all(self, argv, logger):
         options, numeric_args = self.parse_args(argv)
-        return options, numeric_args, makeLogger(options)
+        return options, numeric_args, logger and logger or makeLogger(options)
index 51aea1fb5d1f95bd74bd4490ea8764556947aecd..070945f938129033f0d1f349a9274f3fb901cfff 100644 (file)
@@ -34,5 +34,17 @@ output going to stdout/stderr."""
     base_args = []
     if options.verbose: base_args.append("--verbose")
     if options.dry_run: base_args.append("--dry-run")
-    logger.info(app)
-    raise NotImplementedError
+    deploys = []
+    for line in wd.getInstallLines(global_options):
+        try:
+            deploy = wd.Deployment.parse(line)
+        except wd.DeploymentParseError, wd.NoSuchApplication:
+            continue
+        name = deploy.getApplication().name
+        if name != app: continue
+        deploys.append(deploy)
+    # parallelization code would go here
+    for deploy in deploys:
+        sub_argv = base_args + [deploy.location]
+        logger.info("$ wizard migrate " + " ".join(sub_argv))
+        migrate.migrate(sub_argv, global_options, logger)
index dc5f5aa265971850dc608d04913a8773e2009ee3..09e6ff8e5f7a65e507ceace5701e48952a981085 100644 (file)
@@ -107,10 +107,10 @@ what repository and tag to use."""
         else:
             if os.path.isdir(".git"):
                 logger.warning("Force removing .git directory")
-                shutil.rmtree(".git")
+                if not options.dry_run: shutil.rmtree(".git")
             if os.path.isdir(".scripts"):
                 logger.warning("Force removing .scripts directory")
-                shutil.rmtree(".scripts")
+                if not options.dry_run: shutil.rmtree(".scripts")
     try:
         deploy = wd.Deployment.fromDir(".")
         version = deploy.getAppVersion()
index c84348b271aec20a0ddb01a1e9525b92539ddc77..267240366b26d784954068f6241238aec40c75d0 100644 (file)
@@ -2,6 +2,7 @@ import optparse
 import wizard.deploy as wd
 import sys
 
+# XXX: Migrate this to use logger
 class Printer(object):
     def __init__(self, quiet, verbose):
         self.i = 0