diff options
author | kali <kali@leap.se> | 2012-08-21 05:43:55 +0900 |
---|---|---|
committer | kali <kali@leap.se> | 2012-08-21 05:43:55 +0900 |
commit | d908247dcc2cac66d31f081d892a04833206de3b (patch) | |
tree | 52c44d6ad5d40213bb7b20339d33e7796f00dc70 /src/leap | |
parent | 738b4bf8c6b75a1d73b7fa3e1a5edb69adf9d8a0 (diff) |
fix status_watcher callback stub
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/eip/openvpnconnection.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/leap/eip/openvpnconnection.py b/src/leap/eip/openvpnconnection.py index 601bb54a..81e6b1ba 100644 --- a/src/leap/eip/openvpnconnection.py +++ b/src/leap/eip/openvpnconnection.py @@ -7,6 +7,7 @@ import socket import time from functools import partial +logging.basicConfig() logger = logging.getLogger(name=__name__) from leap.base.connection import Connection @@ -182,14 +183,20 @@ to be triggered for each one of them. #deprecate watcher_cb, #use _only_ signal_maps instead + logger.debug('_launch_openvpn called') if self.watcher_cb is not None: linewrite_callback = self.watcher_cb else: #XXX get logger instead linewrite_callback = lambda line: print('watcher: %s' % line) + # the partial is not + # being applied now because we're not observing the process + # stdout like we did in the early stages. but I leave it + # here since it will be handy for observing patterns in the + # thru-the-manager updates (with regex) observers = (linewrite_callback, - partial(lambda: None, self.status)) + partial(lambda con_status, line: None, self.status)) subp, watcher = spawn_and_watch_process( self.command, self.args, @@ -235,7 +242,7 @@ to be triggered for each one of them. except: #XXX don't like this general #catch here. - pass + raise if self.connected(): return True self.tn = UDSTelnet(self.host, self.port) @@ -250,7 +257,7 @@ to be triggered for each one of them. #self.tn.read_until('SUCCESS:', 2) self._seek_to_eof() - self.forget_errors() + #self.forget_errors() return True def _seek_to_eof(self): @@ -290,6 +297,8 @@ to be triggered for each one of them. """ if tries > 3: return [] + if self.tn is None: + return [] if not self.connected(): try: self.connect() |