Added --quiet option to refresh_project_links mgmt command

This commit is contained in:
Sybren A. Stüvel 2016-04-01 13:29:22 +02:00
parent ce242e1de3
commit 73bb125e7b
2 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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)