]> scripts.mit.edu Git - wizard.git/blob - wizard/command/errors.py
Remove string exception from remaster.
[wizard.git] / wizard / command / errors.py
1 from wizard import app, deploy, command
2
3 def main(argv, baton):
4     options, show = parse_args(argv, baton)
5     for e in deploy.parse_install_lines(show, options.versions_path, True, user=options.user):
6         if not isinstance(e, deploy.Error) and not isinstance(e, app.Error):
7             if isinstance(e, Exception):
8                 raise e
9             continue
10         if options.verbose:
11             if isinstance(e, app.NoSuchApplication):
12                 print "Application %s does not exist, at %s" % (e.app, e.location)
13             elif isinstance(e, app.DeploymentParseError):
14                 print "Parse error for line '%s', at %s" % (e.value, e.location)
15             else:
16                 raise e
17         else:
18             print e.location
19
20 def parse_args(argv, baton):
21     usage = """usage: %prog errors [ARGS]
22
23 Lists all errors that occurred while parsing the versions
24 directory."""
25     parser = command.WizardOptionParser(usage)
26     baton.push(parser, "versions_path")
27     baton.push(parser, "user")
28     options, args = parser.parse_all(argv)
29     if len(args) > 1:
30         parser.error("too many arguments")
31     return options, args
32