From 73bb125e7b366df60d47278f7ca9054ba338b66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 1 Apr 2016 13:29:22 +0200 Subject: [PATCH] Added --quiet option to refresh_project_links mgmt command --- pillar/application/__init__.py | 4 ++-- pillar/manage.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pillar/application/__init__.py b/pillar/application/__init__.py index d746d82f..bc455546 100644 --- a/pillar/application/__init__.py +++ b/pillar/application/__init__.py @@ -102,7 +102,8 @@ logging.getLogger('werkzeug').setLevel(logging.INFO) log = logging.getLogger(__name__) log.setLevel(logging.DEBUG if app.config['DEBUG'] else logging.INFO) -log.info('Pillar starting, debug=%s', app.config['DEBUG']) +if app.config['DEBUG']: + log.info('Pillar starting, debug=%s', app.config['DEBUG']) bugsnag.configure( api_key=app.config['BUGSNAG_API_KEY'], @@ -356,7 +357,6 @@ def after_replacing_user(item, original): """Push an update to the Algolia index when a user item is updated""" algolia_index_user_save(item) - app.on_post_GET_users += post_GET_user app.on_replace_users += after_replacing_user diff --git a/pillar/manage.py b/pillar/manage.py index 9038d5ae..e0439055 100755 --- a/pillar/manage.py +++ b/pillar/manage.py @@ -644,11 +644,17 @@ def subscribe_node_owners(): @manager.command -def refresh_project_links(project, chunk_size=50): +def refresh_project_links(project, chunk_size=50, quiet=False): """Regenerates almost-expired file links for a certain project.""" - chunk_size = int(chunk_size) # CLI parameters are passed as strings + if quiet: + import logging + from application import log + logging.getLogger().setLevel(logging.WARNING) + log.setLevel(logging.WARNING) + + chunk_size = int(chunk_size) # CLI parameters are passed as strings from application.modules import file_storage file_storage.refresh_links_for_project(project, chunk_size, 2 * 3600)