]> scripts.mit.edu Git - wizard.git/blob - wizard/command/database.py
Remove string exception from remaster.
[wizard.git] / wizard / command / database.py
1 import os.path
2
3 from wizard import deploy, command, shell
4
5 def main(argv, baton):
6     options, args = parse_args(argv, baton)
7     dir = os.path.abspath(args[0]) if args else os.getcwd()
8     shell.drop_priviledges(dir, options.log_file)
9     deployment = deploy.ProductionCopy(dir)
10     deployment.verify()
11     deployment.verifyConfigured()
12     print deployment.dsn.database
13
14 def parse_args(argv, baton):
15     usage = """usage: %prog database [DIR]
16
17 Prints the name of the database an application is using.
18 Maybe in the future this will print more information."""
19     parser = command.WizardOptionParser(usage)
20     options, args = parser.parse_all(argv)
21     if len(args) > 1:
22         parser.error("too many arguments")
23     if len(args) == 0:
24         parser.error("must specify directory")
25     return options, args