Add some verbose message for validate / update commands

When you run grafana-dashboards, it currently lacks some basic
information what it is actually doing.  So, start building out some
logging to help others who decide to run the command.

Change-Id: I27b0c444139c5772b29ae3bd2c9550c6567dd4d6
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-10-05 14:17:33 -04:00
parent 82e48fdf08
commit 073d7c6806
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)