summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-05-06 18:04:03 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-05-27 12:05:33 -0300
commit298d73867104e4e81102392ffb0171fd07b8ab33 (patch)
treee8a5b48a62a8119d594ba04226adcb7d7470c1d8
parent13babd9fe81dd7e3af7266fb99306c7726cf84f5 (diff)
[feat] adapt to new events api on common
- Related: #6359
-rw-r--r--keymanager/changes/VERSION_COMPAT2
-rw-r--r--keymanager/changes/feature_adapt-to-new-events-on-common1
-rw-r--r--keymanager/src/leap/keymanager/__init__.py17
3 files changed, 10 insertions, 10 deletions
diff --git a/keymanager/changes/VERSION_COMPAT b/keymanager/changes/VERSION_COMPAT
index ac65675..0bb331a 100644
--- a/keymanager/changes/VERSION_COMPAT
+++ b/keymanager/changes/VERSION_COMPAT
@@ -8,4 +8,4 @@
#
# BEGIN DEPENDENCY LIST -------------------------
# leap.foo.bar>=x.y.z
-leap.common>=0.3.10
+leap.common>=0.4
diff --git a/keymanager/changes/feature_adapt-to-new-events-on-common b/keymanager/changes/feature_adapt-to-new-events-on-common
new file mode 100644
index 0000000..e57e777
--- /dev/null
+++ b/keymanager/changes/feature_adapt-to-new-events-on-common
@@ -0,0 +1 @@
+- Adapt to new events api on leap.common. Related to #5359.
diff --git a/keymanager/src/leap/keymanager/__init__.py b/keymanager/src/leap/keymanager/__init__.py
index f7b1974..47f479b 100644
--- a/keymanager/src/leap/keymanager/__init__.py
+++ b/keymanager/src/leap/keymanager/__init__.py
@@ -47,8 +47,7 @@ from twisted.internet import defer
from urlparse import urlparse
from leap.common.check import leap_assert
-from leap.common.events import signal
-from leap.common.events import events_pb2 as proto
+from leap.common.events import emit, catalog
from leap.common.decorators import memoized_method
from leap.keymanager.errors import (
@@ -278,7 +277,7 @@ class KeyManager(object):
self._api_version,
self._uid)
self._put(uri, data)
- signal(proto.KEYMANAGER_DONE_UPLOADING_KEYS, self._address)
+ emit(catalog.KEYMANAGER_DONE_UPLOADING_KEYS, self._address)
d = self.get_key(
self._address, ktype, private=False, fetch_remote=False)
@@ -314,24 +313,24 @@ class KeyManager(object):
leap_assert(
ktype in self._wrapper_map,
'Unkown key type: %s.' % str(ktype))
- signal(proto.KEYMANAGER_LOOKING_FOR_KEY, address)
+ emit(catalog.KEYMANAGER_LOOKING_FOR_KEY, address)
def key_found(key):
- signal(proto.KEYMANAGER_KEY_FOUND, address)
+ emit(catalog.KEYMANAGER_KEY_FOUND, address)
return key
def key_not_found(failure):
if not failure.check(KeyNotFound):
return failure
- signal(proto.KEYMANAGER_KEY_NOT_FOUND, address)
+ emit(catalog.KEYMANAGER_KEY_NOT_FOUND, address)
# we will only try to fetch a key from nickserver if fetch_remote
# is True and the key is not private.
if fetch_remote is False or private is True:
return failure
- signal(proto.KEYMANAGER_LOOKING_FOR_KEY, address)
+ emit(catalog.KEYMANAGER_LOOKING_FOR_KEY, address)
d = self._fetch_keys_from_server(address)
d.addCallback(
lambda _:
@@ -388,10 +387,10 @@ class KeyManager(object):
self._assert_supported_key_type(ktype)
def signal_finished(key):
- signal(proto.KEYMANAGER_FINISHED_KEY_GENERATION, self._address)
+ emit(catalog.KEYMANAGER_FINISHED_KEY_GENERATION, self._address)
return key
- signal(proto.KEYMANAGER_STARTED_KEY_GENERATION, self._address)
+ emit(catalog.KEYMANAGER_STARTED_KEY_GENERATION, self._address)
d = self._wrapper_map[ktype].gen_key(self._address)
d.addCallback(signal_finished)
return d