From 6060b522bfcbcc379a37c315af83f830c0b0dd71 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 8 Aug 2013 12:12:51 -0300 Subject: Update code to use new Soledad schema selection. --- src/leap/services/soledad/soledadbootstrapper.py | 6 +++++- src/leap/services/soledad/soledadconfig.py | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/leap/services/soledad/soledadbootstrapper.py b/src/leap/services/soledad/soledadbootstrapper.py index ac3243c1..422352ea 100644 --- a/src/leap/services/soledad/soledadbootstrapper.py +++ b/src/leap/services/soledad/soledadbootstrapper.py @@ -139,10 +139,12 @@ class SoledadBootstrapper(AbstractBootstrapper): if self._download_if_needed and mtime: headers['if-modified-since'] = mtime + api_version = self._provider_config.get_api_version() + # there is some confusion with this uri, config_uri = "%s/%s/config/soledad-service.json" % ( self._provider_config.get_api_uri(), - self._provider_config.get_api_version()) + api_version) logger.debug('Downloading soledad config from: %s' % config_uri) srp_auth = SRPAuth(self._provider_config) @@ -158,6 +160,8 @@ class SoledadBootstrapper(AbstractBootstrapper): cookies=cookies) res.raise_for_status() + self._soledad_config.set_api_version(api_version) + # Not modified if res.status_code == 304: logger.debug("Soledad definition has not been modified") diff --git a/src/leap/services/soledad/soledadconfig.py b/src/leap/services/soledad/soledadconfig.py index 80a82d11..a2367692 100644 --- a/src/leap/services/soledad/soledadconfig.py +++ b/src/leap/services/soledad/soledadconfig.py @@ -21,7 +21,7 @@ Soledad configuration import logging from leap.common.config.baseconfig import BaseConfig -from leap.services.soledad.soledadspec import soledad_config_spec +from leap.services.soledad.soledadspec import get_schema logger = logging.getLogger(__name__) @@ -34,11 +34,13 @@ class SoledadConfig(BaseConfig): def __init__(self): BaseConfig.__init__(self) - def _get_spec(self): + def _get_schema(self): """ - Returns the spec object for the specific configuration + Returns the schema corresponding to the version given. + + :rtype: dict or None if the version is not supported. """ - return soledad_config_spec + return get_schema(self._api_version) def get_hosts(self): return self._safe_get_value("hosts") -- cgit v1.2.3