]> scripts.mit.edu Git - wizard.git/commitdiff
Move upgrade code to wizard.app modules.
authorEdward Z. Yang <ezyang@mit.edu>
Tue, 18 Aug 2009 20:00:15 +0000 (16:00 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Tue, 18 Aug 2009 20:13:48 +0000 (16:13 -0400)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
TODO
wizard/app/mediawiki.py
wizard/command/upgrade.py
wizard/deploy.py

diff --git a/TODO b/TODO
index 42aa9bfef3afb06160f68530f341ad42c9efa877..d261dda70b9097e27635ad0bd52f57394e25bf84 100644 (file)
--- a/TODO
+++ b/TODO
@@ -2,17 +2,11 @@ The Git Autoinstaller
 
 TODO NOW:
 
-- Make sure massmigrate cleanly ignores already migrated
-  installs
 - Push su code to migrate, not mass-migrate (only do it
   as root, this serves as a safe guard)
-- Move migration code into Wizard, since we already deal
-  with installation there anyway (this TODO has been updated
-  accordingly)
 
 - Make parallel-find.pl use `sudo -u username git describe --tags`
   to determine version
-- Remove .scripts/version generation in install script
 - Make the installer use 'wizard install' /or/ do a migration
   after doing a normal install (the latter makes it easier
   for mass-rollbacks).
@@ -30,6 +24,9 @@ TODO NOW:
 - The great initial deploy:
     - Turn on mediawiki new autoinstaller
     - Migrate all mediawiki installs
+    - Build research scripts, determine if a re-migration is necessary
+
+- Make upgrade and install take version as a parameter
 
 - Redo Wordpress conversion, with an eye for automating everything
   possible (such as downloading the tarball and unpacking)
index 5c18b159594eec4b8480f1437efe9b7ac1fb7023..966a6a919c1339a64213d5792afa12307880ee33 100644 (file)
@@ -1,7 +1,7 @@
 import re
 import os
 
-from wizard import app, deploy, install, util
+from wizard import app, deploy, install, shell, util
 from wizard.app import php
 
 def make_filename_regex(var):
@@ -48,6 +48,7 @@ class Application(deploy.Application):
             pass
 
         os.chmod("config", 0777) # XXX: vaguely sketchy
+
         postdata = {
             'Sitename': options.title,
             'EmergencyContact': options.email,
@@ -67,4 +68,7 @@ class Application(deploy.Application):
         if result.find("Installation successful") == -1:
             raise install.Failure()
         os.rename('config/LocalSettings.php', 'LocalSettings.php')
+    def upgrade(self, options):
+        sh = shell.Shell()
+        sh.call("php", "maintenance/update.php")
 
index d67d5cd517339d51adcf12997c0295e9b496c6a8..fb04a2d2db0c3a524aa25971862058f13c1e17c0 100644 (file)
@@ -25,6 +25,7 @@ def main(argv, baton):
         repo = open(".git/WIZARD_REPO", "r").read()
         version = open(".git/WIZARD_UPGRADE_VERSION", "r").read()
         command.chdir(sh.eval("git", "config", "remote.origin.url"))
+        d = make_deployment_from_cwd()
     else:
         d = make_deployment_from_cwd()
         repo = d.application.repository(options.srv_path)
@@ -67,7 +68,7 @@ def main(argv, baton):
     #   - merge could fail (race); that's /really/ dangerous.
     sh.call("git", "pull", temp_wc_dir, "master")
     # run update script
-    sh.call(".scripts/update")
+    d.application.upgrade(options)
     # XXX: frob .htaccess to make site accessible
     # XXX:  - check if .htaccess changed, first.  Upgrade
     #       process might have frobbed it.  Don't be
index 7ea4ba247f716e62d1d149e13fde96dca3c02301..fa3f5a1bb2fec3787b5dac02c99f15eb6913fb91 100644 (file)
@@ -281,6 +281,18 @@ class Application(object):
             subs = subst(deployment)
             if not subs and key not in self.deprecated_keys:
                 logging.warning("No substitutions for %s" % key)
+    def install(self, options):
+        """
+        Run for 'wizard configure' (and, by proxy, 'wizard install')
+        to configure an application.
+        """
+        raise NotImplemented
+    def upgrade(self, options):
+        """
+        Run for 'wizard upgrade' to upgrade database schemas and other
+        non-versioned data in an application.
+        """
+        raise NotImplemented
     @property
     def extractors(self):
         """