summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/changes/bug_6892_fix-log-message-for-local-secret2
-rw-r--r--client/changes/bug_fix-async-decrypt2
-rw-r--r--client/src/leap/soledad/client/secrets.py16
3 files changed, 14 insertions, 6 deletions
diff --git a/client/changes/bug_6892_fix-log-message-for-local-secret b/client/changes/bug_6892_fix-log-message-for-local-secret
new file mode 100644
index 00000000..39c13257
--- /dev/null
+++ b/client/changes/bug_6892_fix-log-message-for-local-secret
@@ -0,0 +1,2 @@
+ o Fix the log message when a local secret is not found so it's less
+ confusing. Closes #6892.
diff --git a/client/changes/bug_fix-async-decrypt b/client/changes/bug_fix-async-decrypt
new file mode 100644
index 00000000..eb0ce7b5
--- /dev/null
+++ b/client/changes/bug_fix-async-decrypt
@@ -0,0 +1,2 @@
+ o Refactor asynchronous encryption/decryption code to its own file.
+ o Fix logging and graceful failing when exceptions are raised during sync.
diff --git a/client/src/leap/soledad/client/secrets.py b/client/src/leap/soledad/client/secrets.py
index af781a26..96f7e906 100644
--- a/client/src/leap/soledad/client/secrets.py
+++ b/client/src/leap/soledad/client/secrets.py
@@ -246,22 +246,26 @@ class SoledadSecrets(object):
:return: Whether there's a storage secret for symmetric encryption.
:rtype: bool
"""
- if self._secret_id is None or self._secret_id not in self._secrets:
+ logger.info("Checking if there's a secret in local storage...")
+ if (self._secret_id is None or self._secret_id not in self._secrets) \
+ and os.path.isfile(self._secrets_path):
try:
self._load_secrets() # try to load from disk
except IOError as e:
logger.warning(
'IOError while loading secrets from disk: %s' % str(e))
- return False
- return self.storage_secret is not None
+
+ if self.storage_secret is not None:
+ logger.info("Found a secret in local storage.")
+ return True
+
+ logger.info("Could not find a secret in local storage.")
+ return False
def _load_secrets(self):
"""
Load storage secrets from local file.
"""
- # does the file exist in disk?
- if not os.path.isfile(self._secrets_path):
- raise IOError('File does not exist: %s' % self._secrets_path)
# read storage secrets from file
content = None
with open(self._secrets_path, 'r') as f: