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