Merge "Add some verbose message for validate / update commands"

This commit is contained in:
Jenkins 2015-10-05 21:47:32 +00:00 committed by Gerrit Code Review
commit 29fbf5e7d1
2 changed files with 4 additions and 1 deletions

View File

@ -63,6 +63,7 @@ class Builder(object):
def update_dashboard(self, path):
self.load_files(path)
dashboards = self.parser.data.get('dashboard', {})
LOG.info('Number of dashboards generated: %d', len(dashboards))
for name in dashboards:
data, md5 = self.parser.get_dashboard(name)
if self.cache.has_changed(name, md5):

View File

@ -40,9 +40,11 @@ class Commands(object):
exec_method(**kwargs)
def update(self, path):
LOG.info('Updating dashboards in %s', path)
self.builder.update_dashboard(path)
def validate(self, path):
LOG.info('Validating dashboards in %s', path)
try:
self.builder.load_files(path)
print('SUCCESS!')
@ -69,8 +71,8 @@ command_opt = cfg.SubCommandOpt('action', handler=add_command_parsers)
def main():
CONF.register_cli_opt(command_opt)
logging.register_options(CONF)
logging.setup(CONF, 'grafana-dashboard')
config.prepare_args(sys.argv)
logging.setup(CONF, 'grafana-dashboard')
Commands().execute()
sys.exit(0)