summaryrefslogtreecommitdiff
path: root/src/leap/services/eip/eipconfig.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-08-06 17:20:54 -0300
committerTomás Touceda <chiiph@leap.se>2013-08-06 17:20:54 -0300
commit8f57fbc04d2fa224a5a3fb4560da7ef9b91c202c (patch)
tree02dce93d0072287e01cb73d6d4fce1680c68be94 /src/leap/services/eip/eipconfig.py
parentd6bf9b3e11ff87488a5f508acebf8f20ad026166 (diff)
parentd5ea34c797e56b05fc54a186cf6c998e036f4ed0 (diff)
Merge remote-tracking branch 'ivan/feature/3310_add-support-for-multiple-schemas' into develop
Diffstat (limited to 'src/leap/services/eip/eipconfig.py')
-rw-r--r--src/leap/services/eip/eipconfig.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/leap/services/eip/eipconfig.py b/src/leap/services/eip/eipconfig.py
index 9e3a9b29..2f2f6e7c 100644
--- a/src/leap/services/eip/eipconfig.py
+++ b/src/leap/services/eip/eipconfig.py
@@ -28,7 +28,7 @@ import ipaddr
from leap.common.check import leap_assert, leap_assert_type
from leap.common.config.baseconfig import BaseConfig
from leap.config.providerconfig import ProviderConfig
-from leap.services.eip.eipspec import eipservice_config_spec
+from leap.services.eip.eipspec import get_schema
logger = logging.getLogger(__name__)
@@ -136,12 +136,27 @@ class EIPConfig(BaseConfig):
def __init__(self):
BaseConfig.__init__(self)
+ self._api_version = None
def _get_spec(self):
"""
Returns the spec object for the specific configuration
"""
- return eipservice_config_spec
+ leap_assert(self._api_version is not None,
+ "You should set the API version.")
+
+ return get_schema(self._api_version)
+
+ def set_api_version(self, version):
+ """
+ Sets the supported api version.
+
+ :param api_version: the version of the api supported by the provider.
+ :type api_version: str
+ """
+ self._api_version = version
+ leap_assert(get_schema(self._api_version) is not None,
+ "Version %s is not supported." % (version, ))
def get_clusters(self):
# TODO: create an abstraction for clusters
@@ -243,7 +258,7 @@ if __name__ == "__main__":
console.setFormatter(formatter)
logger.addHandler(console)
- eipconfig = EIPConfig()
+ eipconfig = EIPConfig('1')
try:
eipconfig.get_clusters()