summaryrefslogtreecommitdiff
path: root/client/src
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2015-05-04 13:26:57 -0300
committerdrebs <drebs@leap.se>2015-05-20 10:16:46 -0300
commitb75bedb065cfbbb2993659d867ef554ff70596ae (patch)
tree4625022b5b88013b632289766f3c7cf8bc02716a /client/src
parent6ab3fe57764c2e5f2a5688d377fe46a51437f0be (diff)
[bug] fix log messages for secrets in storage
Diffstat (limited to 'client/src')
-rw-r--r--client/src/leap/soledad/client/secrets.py16
1 files changed, 10 insertions, 6 deletions
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: