summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-06 10:05:45 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-06 10:05:45 -0300
commitd6bf9b3e11ff87488a5f508acebf8f20ad026166 (patch)
treea3de2d064e1bde8d2ae1efc923335d66965943a3 /src
parente95351d812d98b4be6e1e3dafd6855804d95267a (diff)
parent4028fc6be007d32209db8657809539d1e110302d (diff)
Merge remote-tracking branch 'kali/fix/fix_soledad_boostrap' into develop
Conflicts: src/leap/services/soledad/soledadbootstrapper.py
Diffstat (limited to 'src')
-rw-r--r--src/leap/gui/mainwindow.py17
-rw-r--r--src/leap/services/soledad/soledadbootstrapper.py28
2 files changed, 29 insertions, 16 deletions
diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py
index 89790239..87dd4f5c 100644
--- a/src/leap/gui/mainwindow.py
+++ b/src/leap/gui/mainwindow.py
@@ -900,7 +900,6 @@ class MainWindow(QtGui.QMainWindow):
self.ui.stackedWidget.setCurrentIndex(self.EIP_STATUS_INDEX)
- # XXX disabling soledad for now
self._soledad_bootstrapper.run_soledad_setup_checks(
self._provider_config,
self._login_widget.get_user(),
@@ -921,9 +920,11 @@ class MainWindow(QtGui.QMainWindow):
"""
passed = data[self._soledad_bootstrapper.PASSED_KEY]
if not passed:
- # TODO: display in the GUI
- logger.error("Soledad failed to start: %s" %
- (data[self._soledad_bootstrapper.ERROR_KEY],))
+ # TODO: display in the GUI:
+ # should pass signal to a slot in status_panel
+ # that sets the global status
+ logger.warning("Soledad failed to start: %s" %
+ (data[self._soledad_bootstrapper.ERROR_KEY],))
def _soledad_bootstrapped_stage(self, data):
"""
@@ -1397,8 +1398,15 @@ class MainWindow(QtGui.QMainWindow):
if self._srp_auth is not None:
if self._srp_auth.get_session_id() is not None or \
self._srp_auth.get_token() is not None:
+ # XXX this can timeout after loong time: See #3368
self._srp_auth.logout()
+ if self._soledad:
+ logger.debug("Closing soledad...")
+ self._soledad.close()
+ else:
+ logger.error("No instance of soledad was found.")
+
logger.debug('Cleaning pidfiles')
self._cleanup_pidfiles()
@@ -1412,6 +1420,7 @@ class MainWindow(QtGui.QMainWindow):
self._cleanup_and_quit()
self._really_quit = True
+
if self._wizard:
self._wizard.close()
diff --git a/src/leap/services/soledad/soledadbootstrapper.py b/src/leap/services/soledad/soledadbootstrapper.py
index a952fac5..ac3243c1 100644
--- a/src/leap/services/soledad/soledadbootstrapper.py
+++ b/src/leap/services/soledad/soledadbootstrapper.py
@@ -62,6 +62,7 @@ class SoledadBootstrapper(AbstractBootstrapper):
self._download_if_needed = False
self._user = ""
self._password = ""
+ self._soledad = None
@property
def keymanager(self):
@@ -89,10 +90,12 @@ class SoledadBootstrapper(AbstractBootstrapper):
# TODO: Select server based on timezone (issue #3308)
server_dict = self._soledad_config.get_hosts()
- if len(server_dict.keys() > 0):
+ if server_dict.keys():
selected_server = server_dict[server_dict.keys()[0]]
server_url = "https://%s:%s/user-%s" % (
- selected_server["hostname"], selected_server["port"], uuid)
+ selected_server["hostname"],
+ selected_server["port"],
+ uuid)
logger.debug("Using soledad server url: %s" % (server_url,))
@@ -126,12 +129,12 @@ class SoledadBootstrapper(AbstractBootstrapper):
self._soledad_config = SoledadConfig()
headers = {}
- mtime = get_mtime(os.path.join(self._soledad_config
- .get_path_prefix(),
- "leap",
- "providers",
- self._provider_config.get_domain(),
- "soledad-service.json"))
+ mtime = get_mtime(
+ os.path.join(
+ self._soledad_config.get_path_prefix(),
+ "leap", "providers",
+ self._provider_config.get_domain(),
+ "soledad-service.json"))
if self._download_if_needed and mtime:
headers['if-modified-since'] = mtime
@@ -159,9 +162,10 @@ class SoledadBootstrapper(AbstractBootstrapper):
if res.status_code == 304:
logger.debug("Soledad definition has not been modified")
self._soledad_config.load(
- os.path.join("leap", "providers",
- self._provider_config.get_domain(),
- "soledad-service.json"))
+ os.path.join(
+ "leap", "providers",
+ self._provider_config.get_domain(),
+ "soledad-service.json"))
else:
soledad_definition, mtime = get_content(res)
@@ -190,7 +194,7 @@ class SoledadBootstrapper(AbstractBootstrapper):
address,
"https://nicknym.%s:6425" % (self._provider_config.get_domain(),),
self._soledad,
- #token=srp_auth.get_token(), # TODO: enable token usage
+ #token=srp_auth.get_token(), # TODO: enable token usage
session_id=srp_auth.get_session_id(),
ca_cert_path=self._provider_config.get_ca_cert_path(),
api_uri=self._provider_config.get_api_uri(),