summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/bitmask/cli/vpn.py4
-rw-r--r--src/leap/bitmask/core/dispatcher.py3
-rw-r--r--src/leap/bitmask/vpn/helpers/__init__.py6
-rw-r--r--src/leap/bitmask/vpn/service.py9
-rw-r--r--ui/app/lib/bitmask.js8
5 files changed, 21 insertions, 9 deletions
diff --git a/src/leap/bitmask/cli/vpn.py b/src/leap/bitmask/cli/vpn.py
index e413e89d..60c57aac 100644
--- a/src/leap/bitmask/cli/vpn.py
+++ b/src/leap/bitmask/cli/vpn.py
@@ -80,7 +80,7 @@ SUBCOMMANDS:
help='provider to check the VPN')
subargs = parser.parse_args(raw_args)
- provider = None
+ provider = ""
if subargs.provider:
provider = subargs.provider
else:
@@ -88,7 +88,7 @@ SUBCOMMANDS:
try:
_, provider = uid.split('@')
except ValueError:
- raise ValueError("A provider is needed to start the VPN")
+ pass
self.data += ['check', provider]
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index 29a07e6d..c026c490 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -217,8 +217,7 @@ class VPNCmd(SubCommand):
try:
provider = parts[2]
except IndexError:
- raise DispatchError(
- 'wrong number of arguments: expected 1, got none')
+ provider = None
d = vpn.do_check(provider)
return d
diff --git a/src/leap/bitmask/vpn/helpers/__init__.py b/src/leap/bitmask/vpn/helpers/__init__.py
index 8905adfd..69a9a5fb 100644
--- a/src/leap/bitmask/vpn/helpers/__init__.py
+++ b/src/leap/bitmask/vpn/helpers/__init__.py
@@ -1,5 +1,6 @@
from os import remove, chmod
from shutil import copyfile
+import os.path
import sys
from leap.bitmask.vpn.constants import IS_LINUX
@@ -21,6 +22,11 @@ if IS_LINUX:
remove(helper_to)
remove(polkit_to)
+ def check():
+ helper = os.path.exists(helper_to)
+ polkit = os.path.exists(polkit_to)
+ return helper and polkit
+
def main():
if sys.argv[-1] == 'install':
diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py
index 17e20af6..a7dce3d2 100644
--- a/src/leap/bitmask/vpn/service.py
+++ b/src/leap/bitmask/vpn/service.py
@@ -27,7 +27,7 @@ from twisted.internet import defer
from leap.bitmask.hooks import HookableService
from leap.bitmask.vpn.vpn import VPNManager
from leap.bitmask.vpn._checks import is_service_ready, get_vpn_cert_path
-from leap.bitmask.vpn import privilege
+from leap.bitmask.vpn import privilege, helpers
from leap.common.config import get_path_prefix
from leap.common.files import check_and_fix_urw_only
@@ -97,10 +97,13 @@ class VPNService(HookableService):
return status
- def do_check(self, domain):
+ def do_check(self, domain=None):
"""Check whether the VPN Service is properly configured,
and can be started"""
- return {'vpn_ready': is_service_ready(domain)}
+ ret = {'installed': helpers.check()}
+ if domain:
+ ret['vpn_ready'] = is_service_ready(domain)
+ return ret
@defer.inlineCallbacks
def do_get_cert(self, username):
diff --git a/ui/app/lib/bitmask.js b/ui/app/lib/bitmask.js
index b0ada5b9..dd914369 100644
--- a/ui/app/lib/bitmask.js
+++ b/ui/app/lib/bitmask.js
@@ -255,10 +255,14 @@ var bitmask = function(){
/**
* Check if the VPN is ready to start and has the cert downloaded
*
- * @return {Promise<bool>} User readable status
+ * @return {Promise<{'vpn_ready': bool,
+ * 'installed': bool}>}
*/
check: function(provider) {
- return call(['vpn', 'check', provider])
+ if (typeof provider !== 'string') {
+ provider = "";
+ }
+ return call(['vpn', 'check', provider]);
},
/**