]> scripts.mit.edu Git - wizard.git/commitdiff
Add --skip-verification and --disable-rollback flags to upgrade.
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 25 Oct 2010 19:49:50 +0000 (20:49 +0100)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 25 Oct 2010 19:49:50 +0000 (20:49 +0100)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
TODO
wizard/command/upgrade.py

diff --git a/TODO b/TODO
index a351d0b122277fba2206fca854bd20c0e6b31589..6afc3bec69e38e3dc4fe1e12da1c4e90f16e03d9 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
 - [SCRIPTS] MediaWiki 1.9.3 and 1.6.7
 
+- Blacklist should allow an easy way for a user to override it,
+  described in the error message.
 - .wizard/url semantics are subtly wrong: in particular, if we
   explicitly configure a URL at install, we should be able to
   detect this URL as baked in from the configuration
index 43f995e680aa7d938e6844e3f53820841195f693..91530c3a1341239b6c8ae25e18cc9ccb8b516b0a 100644 (file)
@@ -93,6 +93,9 @@ class Upgrade(object):
                 return
             backup = self.backup()
             self.upgrade(backup)
+            # Note: disable_rollback assumes that upgrade is the last
+            # step, if you add another setp you may have to modify this
+            # to accomodate that.
         finally:
             if self.use_shm and self.temp_dir and os.path.exists(self.temp_dir):
                 shutil.rmtree(self.temp_dir)
@@ -167,7 +170,8 @@ class Upgrade(object):
             self.prod.verifyDatabase()
             self.prod.verifyTag(options.srv_path)
             self.prod.verifyGit(options.srv_path)
-            self.prod.verifyConfigured()
+            if not options.skip_verification:
+                self.prod.verifyConfigured()
             try:
                 shell.call("git", "fetch", "--tags") # XXX: hack since some installs have stale tags
             except shell.CallError as e:
@@ -190,7 +194,8 @@ class Upgrade(object):
             break
         else:
             raise VersionRematchFailed
-        self.prod.verifyWeb()
+        if not options.skip_verification:
+            self.prod.verifyWeb()
         self.preflightAlreadyUpgraded()
         self.preflightQuota()
     def preflightBlacklist(self):
@@ -412,12 +417,20 @@ class Upgrade(object):
                     self.prod.upgrade(version_obj, self.options)
                     self.prod.verifyWeb()
                 except app.UpgradeFailure:
-                    logging.warning("Upgrade failed: rolling back")
-                    self.upgradeRollback(backup)
+                    if self.options.disable_rollback:
+                        logging.warning("Upgrade failed, rollback is disabled")
+                        logging.warning("You can manually rollback with: wizard restore top")
+                    else:
+                        logging.warning("Upgrade failed: rolling back")
+                        self.upgradeRollback(backup)
                     raise
                 except deploy.WebVerificationError as e:
-                    logging.warning("Web verification failed: rolling back")
-                    self.upgradeRollback(backup)
+                    if self.options.disable_rollback:
+                        logging.warning("Web verification failed, rollback is disabled")
+                        logging.warning("You can manually rollback with: wizard restore top")
+                    else:
+                        logging.warning("Web verification failed: rolling back")
+                        self.upgradeRollback(backup)
                     raise app.UpgradeVerificationFailure()
         # XXX: frob .htaccess to make site accessible
         #       to do this, check if .htaccess changed, first.  Upgrade
@@ -467,6 +480,10 @@ of the conflicted working tree to stdout, separated by a space."""
             "resolved using the current working directory as the resolved copy.")
     parser.add_option("--force", dest="force", action="store_true",
             default=False, help="Force running upgrade even if it's already at latest version.")
+    parser.add_option("--skip-verification", dest="skip-verification", action="store_true",
+            default=False, help="Skip running configuration and web verification checks.")
+    parser.add_option("--disable-rollback", dest="disable-rollback", action="store_true",
+            default=False, help="Don't automatically rollback the upgrade if the result fails to verify.")
     parser.add_option("--non-interactive", dest="non_interactive", action="store_true",
             default=False, help="Don't drop to shell in event of conflict.")
     parser.add_option("--rr-cache", dest="rr_cache", metavar="PATH",