summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-03-12 15:12:11 +0100
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-03-12 15:12:11 +0100
commit6a67f46f0e4ce048d03517980bbbd30d7192e2f9 (patch)
treeab13c7e19b9e484b80b048d8cf3e32326f20ca99 /service
parent9819b78e0f35b729d409b8e2d1c42fd99d7434ee (diff)
Monkey patched KeyManager._fetch_keys_from_server.
- Now raises KeyNotFound for all problems, not only 404 - Issue #313
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/config/__init__.py54
1 files changed, 28 insertions, 26 deletions
diff --git a/service/pixelated/config/__init__.py b/service/pixelated/config/__init__.py
index 2072278d..1b966744 100644
--- a/service/pixelated/config/__init__.py
+++ b/service/pixelated/config/__init__.py
@@ -36,42 +36,44 @@ import pixelated.support.ext_protobuf
import pixelated.support.ext_sqlcipher
import pixelated.support.ext_esmtp_sender_factory
import pixelated.support.ext_fetch
+import pixelated.support.ext_keymanager_fetch_key
def initialize():
- args = parse_args()
- app = App()
+ with monkey_patch_leap_fetch_keys():
+ args = parse_args()
+ app = App()
- init_logging(args)
- init_leap_cert(args)
+ init_logging(args)
+ init_leap_cert(args)
- if args.register:
- register(*args.register[::-1])
- sys.exit(0)
+ if args.register:
+ register(*args.register[::-1])
+ sys.exit(0)
- if args.dispatcher or args.dispatcher_stdin:
- config_dispatcher(app, args)
- else:
- config_user_agent(app, args)
+ if args.dispatcher or args.dispatcher_stdin:
+ config_dispatcher(app, args)
+ else:
+ config_user_agent(app, args)
- init_events_server()
+ init_events_server()
- def load_app():
- # welcome to deferred hell. Or maybe you'll be welcomed later, who knows.
- loading_app = loading(args)
+ def load_app():
+ # welcome to deferred hell. Or maybe you'll be welcomed later, who knows.
+ loading_app = loading(args)
- def init_soledad():
- return init_soledad_and_user_key(app, args.home)
+ def init_soledad():
+ return init_soledad_and_user_key(app, args.home)
- def stop_loading_app(leap_session):
- d = loading_app.stopListening()
- d.addCallback(partial(start_user_agent_app, leap_session))
+ def stop_loading_app(leap_session):
+ d = loading_app.stopListening()
+ d.addCallback(partial(start_user_agent_app, leap_session))
- def start_user_agent_app(leap_session, _):
- app_factory.create_app(app, args, leap_session)
+ def start_user_agent_app(leap_session, _):
+ app_factory.create_app(app, args, leap_session)
- d = deferToThread(init_soledad)
- d.addCallback(stop_loading_app)
+ d = deferToThread(init_soledad)
+ d.addCallback(stop_loading_app)
- reactor.callWhenRunning(load_app)
- reactor.run()
+ reactor.callWhenRunning(load_app)
+ reactor.run()