summaryrefslogtreecommitdiff
path: root/src/leap/services/eip/eipconfig.py
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-07 19:05:11 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-07 19:05:11 -0300
commit751638b4eb8208e1eaa1beaaed284da6b412bca7 (patch)
tree58a517d1f22a45a581fcca3ff2766663974de3fa /src/leap/services/eip/eipconfig.py
parent6d6600a495ef48e0f04cb78bedca8fb913bada2a (diff)
Change asserts for a custom leap_assert method
Also: - Make SRPAuth and the Bootstrappers be a QObject instead of a QThread so we can use them inside another more generic thread - Add a generic CheckerThread that runs checks or whatever operation as long as it returns a boolean value - Closes the whole application if the wizard is rejected at the first run - Do not fail when the config directory doesn't exist - Set the wizard pixmap logo as LEAP's logo - Improve wizard checks - Make SRPRegister play nice with the CheckerThread
Diffstat (limited to 'src/leap/services/eip/eipconfig.py')
-rw-r--r--src/leap/services/eip/eipconfig.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/leap/services/eip/eipconfig.py b/src/leap/services/eip/eipconfig.py
index ac06fef1..eab5bfd4 100644
--- a/src/leap/services/eip/eipconfig.py
+++ b/src/leap/services/eip/eipconfig.py
@@ -24,6 +24,7 @@ import logging
from leap.config.baseconfig import BaseConfig
from leap.config.providerconfig import ProviderConfig
from leap.services.eip.eipspec import eipservice_config_spec
+from leap.util.check import leap_assert, leap_assert_type
logger = logging.getLogger(__name__)
@@ -61,7 +62,7 @@ class EIPConfig(BaseConfig):
def get_gateway_ip(self, index=0):
gateways = self.get_gateways()
- assert len(gateways) > 0, "We don't have any gateway!"
+ leap_assert(len(gateways) > 0, "We don't have any gateway!")
if index > len(gateways):
index = 0
logger.warning("Provided an unknown gateway index %s, " +
@@ -75,10 +76,8 @@ class EIPConfig(BaseConfig):
Returns the path to the certificate used by openvpn
"""
- assert providerconfig, "We need a provider"
- assert isinstance(providerconfig, ProviderConfig), "The provider " + \
- "needs to be of type ProviderConfig instead of %s" % \
- (type(providerconfig),)
+ leap_assert(providerconfig, "We need a provider")
+ leap_assert_type(providerconfig, ProviderConfig)
cert_path = os.path.join(self.get_path_prefix(),
"leap",
@@ -89,8 +88,8 @@ class EIPConfig(BaseConfig):
"openvpn.pem")
if not about_to_download:
- assert os.path.exists(cert_path), \
- "You need to download the certificate first"
+ leap_assert(os.path.exists(cert_path),
+ "You need to download the certificate first")
logger.debug("Using OpenVPN cert %s" % (cert_path,))
return cert_path