diff options
-rw-r--r-- | changes/feature_blank-server | 1 | ||||
-rw-r--r-- | src/leap/soledad/__init__.py | 21 |
2 files changed, 16 insertions, 6 deletions
diff --git a/changes/feature_blank-server b/changes/feature_blank-server new file mode 100644 index 00000000..6e68c992 --- /dev/null +++ b/changes/feature_blank-server @@ -0,0 +1 @@ + o Allow to initialize soledad with a blank server diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py index 8bdb82a0..b051a80c 100644 --- a/src/leap/soledad/__init__.py +++ b/src/leap/soledad/__init__.py @@ -527,10 +527,11 @@ class Soledad(object): """ Return an instance of the shared recovery database object. """ - return SoledadSharedDatabase.open_database( - urlparse.urljoin(self.server_url, 'shared'), - False, # TODO: eliminate need to create db here. - creds=self._creds) + if self.server_url: + return SoledadSharedDatabase.open_database( + urlparse.urljoin(self.server_url, 'shared'), + False, # TODO: eliminate need to create db here. + creds=self._creds) def _get_secrets_from_shared_db(self): """ @@ -542,7 +543,11 @@ class Soledad(object): """ events.signal( events.events_pb2.SOLEDAD_DOWNLOADING_KEYS, self._uuid) - doc = self._shared_db().get_doc(self._uuid_hash()) + db = self._shared_db() + if not db: + logger.warning('No shared db found') + return + doc = db.get_doc(self._uuid_hash()) events.signal( events.events_pb2.SOLEDAD_DONE_DOWNLOADING_KEYS, self._uuid) return doc @@ -572,7 +577,11 @@ class Soledad(object): # upload secrets to server events.signal( events.events_pb2.SOLEDAD_UPLOADING_KEYS, self._uuid) - self._shared_db().put_doc(doc) + db = self._shared_db() + if not db: + logger.warning('No shared db found') + return + db.put_doc(doc) events.signal( events.events_pb2.SOLEDAD_DONE_UPLOADING_KEYS, self._uuid) |