]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/restore.py
Fix bug where php.ini not being rewritten for MediaWiki.
[wizard.git] / wizard / command / restore.py
index 5b6dfcce23b25c9d71d0181c284eb1e60dfc01d4..57e5aad88b10fe02a21dcd479015763fd50aea2f 100644 (file)
@@ -1,14 +1,15 @@
 import logging
 import os
-import optparse
 import sys
-import distutils.version
 
-from wizard import command, deploy, git, shell, util
+from wizard import command, deploy, shell, util
 
 def main(argv, baton):
     options, args = parse_args(argv, baton)
-    backups = ".scripts/backups"
+    command.chdir_to_production()
+    d = deploy.ProductionCopy(".")
+    d.verify()
+    backups = d.backup_dir
     if not args:
         if not os.path.exists(backups):
             print "No restore points available"
@@ -18,6 +19,8 @@ def main(argv, baton):
         for d in reversed(sorted(os.listdir(backups))):
             if ".bak" in d:
                 continue
+            if d.startswith("."):
+                continue
             if os.listdir(os.path.join(backups, d)):
                 print d
             else:
@@ -40,12 +43,11 @@ def main(argv, baton):
     d.verify()
     d.verifyConfigured()
     tag = "%s-%s" % (d.application.name, version)
-    sh = shell.Shell()
     try:
-        sh.call("git", "rev-parse", tag)
+        shell.call("git", "rev-parse", tag)
     except shell.CallError:
         raise Exception("Tag %s doesn't exist in repository" % tag)
-    sh.call("git", "reset", "-q", "--hard", tag)
+    shell.call("git", "reset", "-q", "--hard", tag)
     d.restore(backup, options)
 
 def parse_args(argv, baton):