comparison piecrust/commands/builtin/info.py @ 163:6d23473fab41

sources: Add `chef sources` command to list page sources.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 01 Jan 2015 21:21:00 -0800
parents c4b155b08b52
children 4534ccbdd2a3
comparison
equal deleted inserted replaced
162:c4b155b08b52 163:6d23473fab41
45 else: 45 else:
46 logger.info(show) 46 logger.info(show)
47 elif ctx.args.path: 47 elif ctx.args.path:
48 logger.error("No such configuration path: %s" % ctx.args.path) 48 logger.error("No such configuration path: %s" % ctx.args.path)
49 ctx.result = 1 49 ctx.result = 1
50
51
52 class ShowSourcesCommand(ChefCommand):
53 def __init__(self):
54 super(ShowSourcesCommand, self).__init__()
55 self.name = 'sources'
56 self.description = "Shows the sources defined for this website."
57
58 def setupParser(self, parser, app):
59 pass
60
61 def run(self, ctx):
62 for src in ctx.app.sources:
63 logger.info("%s:" % src.name)
64 logger.info(" type: %s" % src.config.get('type'))
65 logger.info(" class: %s" % type(src))
50 66
51 67
52 class ShowRoutesCommand(ChefCommand): 68 class ShowRoutesCommand(ChefCommand):
53 def __init__(self): 69 def __init__(self):
54 super(ShowRoutesCommand, self).__init__() 70 super(ShowRoutesCommand, self).__init__()