# HG changeset patch # User Julien Cristau # Date 1436271190 -7200 # Node ID 459d6f24754b786da105d58939960208e1d7d5a7 # Parent b8fddae83a460a300e93d4d1b74f61f9d40e0f2a [serverct] call server_{maintenance,shutdown} hooks around source-sync command diff -r b8fddae83a46 -r 459d6f24754b server/serverctl.py --- a/server/serverctl.py Tue Jul 07 14:12:46 2015 +0200 +++ b/server/serverctl.py Tue Jul 07 14:13:10 2015 +0200 @@ -991,12 +991,16 @@ config.log_format = '%(levelname)s %(name)s: %(message)s' init_cmdline_log_threshold(config, self['loglevel']) repo = repoapi.get_repository(config=config) + repo.hm.call_hooks('server_maintenance', repo=repo) try: - source = repo.sources_by_uri[args[1]] - except KeyError: - raise ExecutionError('no source named %r' % args[1]) - with repo.internal_cnx() as cnx: - stats = source.pull_data(cnx, force=True, raise_on_error=True) + try: + source = repo.sources_by_uri[args[1]] + except KeyError: + raise ExecutionError('no source named %r' % args[1]) + with repo.internal_cnx() as cnx: + stats = source.pull_data(cnx, force=True, raise_on_error=True) + finally: + repo.shutdown() for key, val in stats.iteritems(): if val: print key, ':', val