diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-03-07 19:05:11 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-03-07 19:05:11 -0300 |
commit | 751638b4eb8208e1eaa1beaaed284da6b412bca7 (patch) | |
tree | 58a517d1f22a45a581fcca3ff2766663974de3fa /src/leap/services/eip/vpn.py | |
parent | 6d6600a495ef48e0f04cb78bedca8fb913bada2a (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/vpn.py')
-rw-r--r-- | src/leap/services/eip/vpn.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/leap/services/eip/vpn.py b/src/leap/services/eip/vpn.py index f117cdbc..88692442 100644 --- a/src/leap/services/eip/vpn.py +++ b/src/leap/services/eip/vpn.py @@ -29,6 +29,7 @@ from leap.config.providerconfig import ProviderConfig from leap.services.eip.vpnlaunchers import get_platform_launcher from leap.services.eip.eipconfig import EIPConfig from leap.services.eip.udstelnet import UDSTelnet +from leap.util.check import leap_assert, leap_assert_type logger = logging.getLogger(__name__) ON_POSIX = 'posix' in sys.builtin_module_names @@ -123,13 +124,11 @@ class VPN(QtCore.QThread): socket, or port otherwise @type socket_port: str """ - assert eipconfig, "We need an eip config" - assert isinstance(eipconfig, EIPConfig), "Expected EIPConfig " + \ - "object instead of %s" % (type(eipconfig),) - assert providerconfig, "We need a provider config" - assert isinstance(providerconfig, ProviderConfig), "Expected " + \ - "ProviderConfig object instead of %s" % (type(providerconfig),) - assert not self._started, "Starting process more than once!" + leap_assert(eipconfig, "We need an eip config") + leap_assert_type(eipconfig, EIPConfig) + leap_assert(providerconfig, "We need a provider config") + leap_assert_type(providerconfig, ProviderConfig) + leap_assert(not self._started, "Starting process more than once!") logger.debug("Starting VPN...") @@ -202,7 +201,7 @@ class VPN(QtCore.QThread): @return: response read @rtype: list """ - assert self._tn, "We need a tn connection!" + leap_assert(self._tn, "We need a tn connection!") try: self._tn.write("%s\n" % (command,)) buf = self._tn.read_until(until, 2) |