]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/prepare_config.py
Convert ad hoc shell calls to singleton instance; fix upgrade bug.
[wizard.git] / wizard / command / prepare_config.py
index 9c08b0dadf7e6f22298de5156d343ff66e3490e2..13a4bc92910d28aaa8a99c6962d968d567cada77 100644 (file)
@@ -1,28 +1,29 @@
 import sys
+import os.path
 
 from wizard import command, deploy, shell
 
 def main(argv, baton):
     options, args = parse_args(argv, baton)
-    sh = shell.Shell()
     wc = deploy.WorkingCopy(".")
-    try:
-        configure_args = args + command.make_base_args(options)
-        sh.call("wizard", "configure", *configure_args, interactive=True)
-    except shell.PythonCallError:
-        sys.exit(1)
+    wc.verify()
+    wc.verifyConfigured()
+    # worst case scenario protection
+    for file in wc.application.parametrized_files:
+        shell.call("git", "add", file)
+    shell.call("git", "commit", "--allow-empty", "-am", "Protection commit")
+    shell.call("git", "reset", "HEAD~")
     wc.prepareConfig()
 
 def parse_args(argv, baton):
-    usage = """usage: %prog prepare-config -- [SETUPARGS]
+    usage = """usage: %prog prepare-config
 
 During the preparation of an upgrade, changes to configuration files
 must be taken into account.  Unfortunately, configuration files
 are not commonly versioned, and are commonly autogenerated.  Running
 this command will update all configuration files.
 
-To be more specific, it takes a checked out repository, and performs a
-configuration.  Then, it replaces the specific values from the installation
+To be more specific, it replaces the specific values from the installation
 back with generic values, which can be committed to the repository.  The final
 working copy state has HEAD pointing to the -scripts version that the commit
 was based off of, but with local changes that can be incorporated using