summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2017-02-22 01:16:39 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2017-02-23 00:42:20 +0100
commit143c61353479c8040eb1160984af7cfbe7e53a55 (patch)
tree2ce62f2759a1118dcead4d534e5a1a6f30a9334b
parent25ad6f18057ad7951f74eff35afe25d220952efa (diff)
[refactor] complete eip -> vpn rename in core
-rw-r--r--src/leap/bitmask/cli/vpn.py3
-rw-r--r--src/leap/bitmask/core/configurable.py4
-rw-r--r--src/leap/bitmask/core/dispatcher.py50
-rw-r--r--src/leap/bitmask/core/dummy.py2
-rw-r--r--src/leap/bitmask/core/mail_services.py2
-rw-r--r--src/leap/bitmask/core/service.py16
6 files changed, 39 insertions, 38 deletions
diff --git a/src/leap/bitmask/cli/vpn.py b/src/leap/bitmask/cli/vpn.py
index ace8677..6683f6f 100644
--- a/src/leap/bitmask/cli/vpn.py
+++ b/src/leap/bitmask/cli/vpn.py
@@ -41,4 +41,5 @@ SUBCOMMANDS:
'''.format(name=command.appname)
commands = ['start', 'stop', 'status', 'check',
- 'get_cert', 'install', 'uninstall']
+ 'get_cert', 'install', 'uninstall',
+ 'enable', 'disable']
diff --git a/src/leap/bitmask/core/configurable.py b/src/leap/bitmask/core/configurable.py
index 692ec06..76e5e11 100644
--- a/src/leap/bitmask/core/configurable.py
+++ b/src/leap/bitmask/core/configurable.py
@@ -29,7 +29,7 @@ from leap.bitmask.config import (
class ConfigurableService(service.MultiService):
config_file = u"bitmaskd.cfg"
- service_names = ('mail', 'eip', 'zmq', 'web', 'websockets')
+ service_names = ('mail', 'vpn', 'zmq', 'web', 'websockets')
def __init__(self, basedir=DEFAULT_BASEDIR):
service.MultiService.__init__(self)
@@ -46,7 +46,7 @@ class ConfigurableService(service.MultiService):
DEFAULT_CONFIG = """
[services]
mail = True
-eip = False
+vpn = False
zmq = True
web = True
onion = False
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index c99bcde..f0c4e76 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -175,9 +175,9 @@ class UserCmd(SubCommand):
user, current_password, new_password)
-class EIPCmd(SubCommand):
+class VPNCmd(SubCommand):
- label = 'eip'
+ label = 'vpn'
@register_method('dict')
def do_ENABLE(self, service, *parts):
@@ -190,48 +190,48 @@ class EIPCmd(SubCommand):
return d
@register_method('dict')
- def do_STATUS(self, eip, *parts):
- d = eip.do_status()
+ def do_STATUS(self, vpn, *parts):
+ d = vpn.do_status()
return d
@register_method('dict')
- def do_START(self, eip, *parts):
+ def do_START(self, vpn, *parts):
+ # TODO --- attempt to get active provider
+ # TODO or catch the exception and send error
try:
provider = parts[2]
except IndexError:
raise DispatchError(
'wrong number of arguments: expected 1, got none')
- # TODO --- attempt to get active provider
- # TODO or catch the exception and send error
provider = parts[2]
- d = eip.start_vpn(provider)
+ d = vpn.start_vpn(provider)
return d
@register_method('dict')
- def do_STOP(self, eip, *parts):
- d = eip.stop_vpn()
+ def do_STOP(self, vpn, *parts):
+ d = vpn.stop_vpn()
return d
@register_method('dict')
- def do_CHECK(self, eip, *parts):
- d = eip.do_check()
+ def do_CHECK(self, vpn, *parts):
+ d = vpn.do_check()
return d
@register_method('dict')
- def do_GET_CERT(self, eip, *parts):
+ def do_GET_CERT(self, vpn, *parts):
# TODO -- attempt to get active provider
provider = parts[2]
- d = eip.do_get_cert(provider)
+ d = vpn.do_get_cert(provider)
return d
@register_method('dict')
- def do_INSTALL(self, eip, *parts):
- d = eip.do_install()
+ def do_INSTALL(self, vpn, *parts):
+ d = vpn.do_install()
return d
@register_method('dict')
- def do_UNINSTALL(self, eip, *parts):
- d = eip.do_uninstall()
+ def do_UNINSTALL(self, vpn, *parts):
+ d = vpn.do_uninstall()
return d
@@ -406,7 +406,7 @@ class CommandDispatcher(object):
self.core = core
self.subcommand_core = CoreCmd()
self.subcommand_bonafide = BonafideCmd()
- self.subcommand_eip = EIPCmd()
+ self.subcommand_vpn = VPNCmd()
self.subcommand_mail = MailCmd()
self.subcommand_keys = KeysCmd()
self.subcommand_events = EventsCmd()
@@ -425,17 +425,17 @@ class CommandDispatcher(object):
d.addCallbacks(_format_result, _format_error)
return d
- def do_EIP(self, *parts):
- eip = self._get_service(self.subcommand_eip.label)
- if not eip:
- return _format_result({'eip': 'disabled'})
+ def do_VPN(self, *parts):
+ vpn = self._get_service(self.subcommand_vpn.label)
+ if not vpn:
+ return _format_result({'vpn': 'disabled'})
subcmd = parts[1]
- dispatch = self.subcommand_eip.dispatch
+ dispatch = self.subcommand_vpn.dispatch
if subcmd in ('enable', 'disable'):
d = dispatch(self.core, *parts)
else:
- d = dispatch(eip, *parts)
+ d = dispatch(vpn, *parts)
d.addCallbacks(_format_result, _format_error)
return d
diff --git a/src/leap/bitmask/core/dummy.py b/src/leap/bitmask/core/dummy.py
index 51eec1a..52580c2 100644
--- a/src/leap/bitmask/core/dummy.py
+++ b/src/leap/bitmask/core/dummy.py
@@ -29,7 +29,7 @@ class CannedData:
'soledad': 'running',
'keymanager': 'running',
'mail': 'running',
- 'eip': 'stopped',
+ 'vpn': 'stopped',
'backend': 'dummy'}
version = {'version_core': '0.0.1'}
stop = {'stop': 'ok'}
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index b1bdea2..98f88ad 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -795,7 +795,7 @@ class IncomingMailService(service.MultiService):
#
-SERVICES = ('soledad', 'smtp', 'eip')
+SERVICES = ('soledad', 'smtp', 'vpn')
Provider = namedtuple(
diff --git a/src/leap/bitmask/core/service.py b/src/leap/bitmask/core/service.py
index 65b5ddc..902bfa6 100644
--- a/src/leap/bitmask/core/service.py
+++ b/src/leap/bitmask/core/service.py
@@ -32,7 +32,7 @@ from leap.bitmask.core import _zmq
from leap.bitmask.core import flags
from leap.bitmask.core import _session
from leap.bitmask.core.web.service import HTTPDispatcherService
-from leap.bitmask.vpn.service import EIPService
+from leap.bitmask.vpn.service import VPNService
from leap.common.events import server as event_server
logger = Logger()
@@ -76,8 +76,8 @@ class BitmaskBackend(configurable.ConfigurableService):
if enabled('mail'):
on_start(self._init_mail_services)
- if enabled('eip'):
- on_start(self._init_eip)
+ if enabled('vpn'):
+ on_start(self._init_vpn)
if enabled('zmq'):
on_start(self._init_zmq)
@@ -165,8 +165,8 @@ class BitmaskBackend(configurable.ConfigurableService):
service = mail_services.StandardMailService
self._maybe_init_service('mail', service, self.basedir)
- def _init_eip(self):
- self._maybe_init_service('eip', EIPService)
+ def _init_vpn(self):
+ self._maybe_init_service('vpn', VPNService)
def _init_zmq(self):
zs = _zmq.ZMQServerService(self)
@@ -213,8 +213,8 @@ class BitmaskBackend(configurable.ConfigurableService):
self._init_mail_services()
self._start_mail_services()
- elif service == 'eip':
- self._init_eip()
+ elif service == 'vpn':
+ self._init_vpn()
elif service == 'zmq':
self._init_zmq()
@@ -245,7 +245,7 @@ class BackendCommands(object):
def do_status(self):
# we may want to make this tuple a class member
- services = ('soledad', 'keymanager', 'mail', 'eip', 'web')
+ services = ('soledad', 'keymanager', 'mail', 'vpn', 'web')
status = {}
for name in services: