summaryrefslogtreecommitdiff
path: root/src/leap/eip/config.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-11-13 21:54:04 +0900
committerkali <kali@leap.se>2012-11-13 21:54:04 +0900
commitd2dcf5a1060d60c451570349a6a06ad102d6924c (patch)
tree0797f2ff3bb8137f7ceff33eec91a033f60c2ab0 /src/leap/eip/config.py
parentd2d2bbd96a44c347c248a7abb2ee72d7d728d79f (diff)
fix missing provider parameter in leapconfig objects chain
Diffstat (limited to 'src/leap/eip/config.py')
-rw-r--r--src/leap/eip/config.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/leap/eip/config.py b/src/leap/eip/config.py
index 57e15c9e..42c00380 100644
--- a/src/leap/eip/config.py
+++ b/src/leap/eip/config.py
@@ -35,9 +35,13 @@ class EIPServiceConfig(baseconfig.JSONLeapConfig):
spec = eipspecs.eipservice_config_spec
def _get_slug(self):
+ domain = getattr(self, 'domain', None)
+ if domain:
+ path = baseconfig.get_provider_path(domain)
+ else:
+ path = baseconfig.get_default_provider_path()
return baseconfig.get_config_file(
- 'eip-service.json',
- folder=baseconfig.get_default_provider_path())
+ 'eip-service.json', folder=path)
def _set_slug(self):
raise AttributeError("you cannot set slug")
@@ -53,15 +57,16 @@ def get_socket_path():
return socket_path
-def get_eip_gateway():
+def get_eip_gateway(provider=None):
"""
return the first host in eip service config
that matches the name defined in the eip.json config
file.
"""
placeholder = "testprovider.example.org"
- eipconfig = EIPConfig()
- #import ipdb;ipdb.set_trace()
+ # XXX check for null on provider??
+
+ eipconfig = EIPConfig(domain=provider)
eipconfig.load()
conf = eipconfig.config
@@ -69,7 +74,7 @@ def get_eip_gateway():
if not primary_gateway:
return placeholder
- eipserviceconfig = EIPServiceConfig()
+ eipserviceconfig = EIPServiceConfig(domain=provider)
eipserviceconfig.load()
eipsconf = eipserviceconfig.get_config()
gateways = eipsconf.get('gateways', None)
@@ -134,7 +139,7 @@ def build_ovpn_options(daemon=False, socket_path=None, **kwargs):
# remote
opts.append('--remote')
- gw = get_eip_gateway()
+ gw = get_eip_gateway(provider=provider)
logger.debug('setting eip gateway to %s', gw)
opts.append(str(gw))
opts.append('1194')