summaryrefslogtreecommitdiff
path: root/src/leap/services
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-13 14:02:13 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-13 14:02:13 -0300
commitef43dff37c6db915757184ad51bc017d45e70c98 (patch)
treea07b0a4d18efe2962a54132cbe134a3c73d059f9 /src/leap/services
parent4359515dafe572398262ce91bf88d4f122042981 (diff)
Notify the user of pkexec/polkit/openvpn checks
Diffstat (limited to 'src/leap/services')
-rw-r--r--src/leap/services/eip/vpnlaunchers.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py
index 6f277481..9345c0b3 100644
--- a/src/leap/services/eip/vpnlaunchers.py
+++ b/src/leap/services/eip/vpnlaunchers.py
@@ -38,6 +38,18 @@ class VPNLauncherException(Exception):
pass
+class OpenVPNNotFoundException(VPNLauncherException):
+ pass
+
+
+class EIPNoPolkitAuthAgentAvailable(VPNLauncherException):
+ pass
+
+
+class EIPNoPkexecAvailable(VPNLauncherException):
+ pass
+
+
class VPNLauncher:
"""
Abstract launcher class
@@ -45,7 +57,6 @@ class VPNLauncher:
__metaclass__ = ABCMeta
- # TODO: document parameters
@abstractmethod
def get_vpn_command(self, eipconfig=None, providerconfig=None,
socket_host=None, socket_port=None):
@@ -137,9 +148,9 @@ def _has_updown_scripts(path):
def _is_auth_agent_running():
- return bool(
+ return len(
commands.getoutput(
- 'ps aux | grep polkit-[g]nome-authentication-agent-1'))
+ 'ps aux | grep polkit-[g]nome-authentication-agent-1')) > 0
class LinuxVPNLauncher(VPNLauncher):
@@ -181,7 +192,7 @@ class LinuxVPNLauncher(VPNLauncher):
openvpn_possibilities = which(self.OPENVPN_BIN)
if len(openvpn_possibilities) == 0:
- raise VPNLauncherException("We couldn't find openvpn")
+ raise OpenVPNNotFoundException()
openvpn = openvpn_possibilities[0]
args = []
@@ -196,8 +207,10 @@ class LinuxVPNLauncher(VPNLauncher):
else:
logger.warning("No polkit auth agent found. pkexec " +
"will use its own auth agent.")
+ raise EIPNoPolkitAuthAgentAvailable()
else:
logger.warning("System has no pkexec")
+ raise EIPNoPkexecAvailable()
# TODO: handle verbosity