Add -p/--protocol to allow only some protocols to be used.
twisty
Add -p/--protocol to allow only some protocols to be used.
--- a/server/python/run-raindrop.py
+++ b/server/python/run-raindrop.py
@@ -3,16 +3,17 @@
import sys
import optparse
import logging
from twisted.internet import reactor, defer
from junius import model
from junius import bootstrap
+from junius.sync import get_conductor
logger = logging.getLogger('raindrop')
class HelpFormatter(optparse.IndentedHelpFormatter):
def format_description(self, description):
return description
# a decorator for our global functions, so they can force other commands
@@ -39,17 +40,16 @@ def install_accounts(result, parser, opt
def install_files(result, parser, options):
"""Install all local content files into the database"""
return model.fab_db(update_views=True
).addCallback(bootstrap.install_client_files)
def sync_messages(result, parser, options):
"""Synchronize all messages from all accounts"""
- from junius.sync import get_conductor
conductor = get_conductor()
return conductor.sync(None)
def _setup_logging(options):
init_errors = []
logging.basicConfig()
for val in options.log_level: # a list of all --log-level options...
try:
@@ -94,20 +94,27 @@ def main():
parser.add_option("-l", "--log-level", action="append",
help="Specifies either an integer or a logging module "
"constant (such as INFO) to set all logs to the "
"specified level. Optionally can be in the format "
"of 'log.name=level' to only set the level of the "
"specified log.",
default=["INFO"])
+ parser.add_option("-p", "--protocol", action="append", dest='protocols',
+ help="Specifies the protocols to enable. If not "
+ "specified, all protocols are enabled")
+
options, args = parser.parse_args()
_setup_logging(options)
+ # do this very early just to set the options
+ get_conductor(options)
+
# create an initial deferred to perform tasks which must occur before we
# can start. The final callback added will fire up the real servers.
if args and args[0]=='help':
if args[1:]:
which = args[1:]
else:
which = all_args.keys()
for this in which: