]> scripts.mit.edu Git - wizard.git/blob - wizard/command/prepare_config.py
Remove unnecessary imports.
[wizard.git] / wizard / command / prepare_config.py
1 import sys
2
3 from wizard import command, deploy, shell
4
5 def main(argv, baton):
6     options, args = parse_args(argv, baton)
7     sh = shell.Shell()
8     wc = deploy.WorkingCopy(".")
9     try:
10         configure_args = args + command.make_base_args(options)
11         sh.call("wizard", "configure", *configure_args, interactive=True)
12     except shell.PythonCallError:
13         sys.exit(1)
14     wc.prepareConfig()
15
16 def parse_args(argv, baton):
17     usage = """usage: %prog prepare-config -- [SETUPARGS]
18
19 During the preparation of an upgrade, changes to configuration files
20 must be taken into account.  Unfortunately, configuration files
21 are not commonly versioned, and are commonly autogenerated.  Running
22 this command will update all configuration files.
23
24 To be more specific, it takes a checked out repository, and performs a
25 configuration.  Then, it replaces the specific values from the installation
26 back with generic values, which can be committed to the repository.  The final
27 working copy state has HEAD pointing to the -scripts version that the commit
28 was based off of, but with local changes that can be incorporated using
29 `git commit --amend -a`.  You should inspect the changes with `git diff`;
30 it is possible that the regular expressions in wizard.app.APPNAME are
31 now non-functional.
32
33 Wizard should be run in the environment installations are planned
34 to be deployed to, because installers can have subtle differences
35 in configuration files based on detected server configuration.
36 """
37     parser = command.WizardOptionParser(usage)
38     return parser.parse_all(argv)
39