]> scripts.mit.edu Git - wizard.git/commitdiff
Add --disable-rollback flag for wizard upgrade.
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 21 Jun 2010 00:12:23 +0000 (17:12 -0700)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 21 Jun 2010 00:12:23 +0000 (17:12 -0700)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/command/upgrade.py

index a3f2198c83831396946206dfdb2e1c5a7b8957b0..bea128392039ddf8cf1e8bc1e3b11011c92a2b13 100644 (file)
@@ -415,11 +415,14 @@ class Upgrade(object):
     def upgradeRollback(self, backup):
         # You don't want d.restore() because it doesn't perform
         # the file level backup
-        shell.call("wizard", "restore", backup)
-        try:
-            self.prod.verifyWeb()
-        except deploy.WebVerificationError:
-            logging.critical("Web verification failed after rollback")
+        if not self.options.disable_rollback:
+            shell.call("wizard", "restore", backup)
+            try:
+                self.prod.verifyWeb()
+            except deploy.WebVerificationError:
+                logging.critical("Web verification failed after rollback")
+        else:
+            logging.warning("Rollback was disabled; you can rollback with `wizard restore %s`", backup)
 
 # utility functions
 
@@ -458,6 +461,9 @@ of the conflicted working tree to stdout, separated by a space."""
     parser.add_option("--rr-cache", dest="rr_cache", metavar="PATH",
             default=None, help="Use this folder to reuse recorded merge resolutions.  Defaults to"
             "your production copy's rr-cache, if it exists.")
+    parser.add_option("--disable-rollback", dest="disable_rollback", action="store_true",
+            default=command.boolish(os.getenv("WIZARD_DISABLE_ROLLBACK")),
+            help="Skips rollback in the event of a failed upgrade. Envvar is WIZARD_DISABLE_ROLLBACK.")
     baton.push(parser, "srv_path")
     options, args = parser.parse_all(argv)
     if len(args) > 1: