summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-08-21 03:11:32 +0900
committerkali <kali@leap.se>2012-08-21 03:11:32 +0900
commitf5948577939dce4f85dd86f37c0823a0a852e074 (patch)
tree74e92cb64244d331176652cd4eb6a7fb44c397d5
parentd3a37a630fe0f8355ec76a007801b3b0cb01bfc2 (diff)
fix imports + style cleaning
-rw-r--r--src/leap/base/connection.py7
-rw-r--r--src/leap/baseapp/mainwindow.py2
-rw-r--r--src/leap/eip/eipconnection.py13
-rw-r--r--src/leap/eip/openvpnconnection.py35
4 files changed, 36 insertions, 21 deletions
diff --git a/src/leap/base/connection.py b/src/leap/base/connection.py
index 6e5086b..cd0ae56 100644
--- a/src/leap/base/connection.py
+++ b/src/leap/base/connection.py
@@ -2,6 +2,9 @@
Base Connection Classs
"""
from __future__ import (division, unicode_literals, print_function)
+
+#XXX move these imports to util.coroutines!!!
+
#import threading
#from functools import partial
import logging
@@ -11,8 +14,8 @@ import logging
#from leap.eip.vpnwatcher import EIPConnectionStatus, status_watcher
from leap.eip.vpnmanager import ConnectionRefusedError
-from leap.configuration import Configuration
-from leap.authentication import Authentication
+from leap.base.configuration import Configuration
+from leap.base.authentication import Authentication
logger = logging.getLogger(name=__name__)
diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py
index 544667f..4d1eee7 100644
--- a/src/leap/baseapp/mainwindow.py
+++ b/src/leap/baseapp/mainwindow.py
@@ -19,7 +19,7 @@ from leap.eip.config import (EIPInitBadKeyFilePermError)
# from leap.eip import exceptions as eip_exceptions
from leap.gui import mainwindow_rc
-from leap.EIPConnection import EIPConnection
+from leap.eip.eipconnection import EIPConnection
class LeapWindow(QMainWindow):
diff --git a/src/leap/eip/eipconnection.py b/src/leap/eip/eipconnection.py
index f16f01f..a0fdd77 100644
--- a/src/leap/eip/eipconnection.py
+++ b/src/leap/eip/eipconnection.py
@@ -1,9 +1,15 @@
"""
EIP Connection Class
"""
+from __future__ import (absolute_import,)
+import logging
+
+logger = logging.getLogger(name=__name__)
+
+from leap.eip.openvpnconnection import (
+ OpenVPNConnection, ConnectionRefusedError)
+from leap.base.connection import ConnectionError
-from leap.OpenVPNConnection import OpenVPNConnection, MissingSocketError, ConnectionRefusedError
-from leap.Connection import ConnectionError
class EIPConnection(OpenVPNConnection):
"""
@@ -39,7 +45,6 @@ class EIPConnection(OpenVPNConnection):
"""
self._disconnect()
self.status.change_to(self.status.DISCONNECTED)
- pass
def shutdown(self):
"""
@@ -262,7 +267,7 @@ class EIPConnectionStatus(object):
cb(self)
-
+# XXX move to exceptions
class EIPClientError(ConnectionError):
"""
base EIPClient Exception
diff --git a/src/leap/eip/openvpnconnection.py b/src/leap/eip/openvpnconnection.py
index a26059a..d3ce357 100644
--- a/src/leap/eip/openvpnconnection.py
+++ b/src/leap/eip/openvpnconnection.py
@@ -12,9 +12,10 @@ from functools import partial
logger = logging.getLogger(name=__name__)
-from leap.utils.coroutines import spawn_and_watch_process
-from leap.baseapp.config import get_config
-from leap.Connection import Connection
+from leap.util.coroutines import spawn_and_watch_process
+from leap.eip.config import get_config
+from leap.base.connection import Connection
+
class OpenVPNConnection(Connection):
"""
@@ -23,7 +24,13 @@ class OpenVPNConnection(Connection):
"""
# Connection Methods
- def __init__(self, config_file=None, watcher_cb=None,host="/tmp/.eip.sock", port="unix", password=None):
+ def __init__(self, config_file=None,
+ watcher_cb=None,
+ debug=False,
+ host="/tmp/.eip.sock",
+ port="unix",
+ password=None,
+ *args, **kwargs):
#XXX FIXME
#change watcher_cb to line_observer
"""
@@ -66,20 +73,20 @@ to be triggered for each one of them.
#manage a connection error
self.with_errors = False
-
- def _set_command_mockup(self):
- """
- sets command and args for a command mockup
- that just mimics the output from the real thing
- """
- command, args = get_vpn_stdout_mockup()
- self.command, self.args = command, args
+ #def _set_command_mockup(self):
+ #"""
+ #sets command and args for a command mockup
+ #that just mimics the output from the real thing
+ #"""
+ #command, args = get_vpn_stdout_mockup()
+ #self.command, self.args = command, args
def _get_config(self):
"""
retrieves the config options from defaults or
home file, or config file passed in command line.
"""
+ #XXX merge! was changed in test-eip branch!!!
config = get_config(config_file=self.config_file)
self.config = config
@@ -97,8 +104,8 @@ to be triggered for each one of them.
self.command = command
#print("debug: command = %s" % command)
self.args = args
- else:
- self._set_command_mockup()
+ #else:
+ #self._set_command_mockup()
if config.has_option('openvpn', 'autostart'):
autostart = config.get('openvpn', 'autostart')