summaryrefslogtreecommitdiff
path: root/src/leap/eip
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-11-19 14:09:24 +0900
committerkali <kali@leap.se>2012-11-19 14:11:57 +0900
commit78db9729c2f6714df4739b28d66be845019a1bf6 (patch)
treec3bca83bf12731dcdd5f262794c4a5749804be2a /src/leap/eip
parent834b04317535cb6d18c02e3aa4d37b09fcf99868 (diff)
fix delete temporal files
Diffstat (limited to 'src/leap/eip')
-rw-r--r--src/leap/eip/openvpnconnection.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/leap/eip/openvpnconnection.py b/src/leap/eip/openvpnconnection.py
index 45a1847c..85874cfd 100644
--- a/src/leap/eip/openvpnconnection.py
+++ b/src/leap/eip/openvpnconnection.py
@@ -214,12 +214,14 @@ to be triggered for each one of them.
# delete
if self.port == "unix":
- # I'm tempted to catch a generic exception here,
- # but I prefer to let it crash so we can catch
- # specific errors that right now I'm not able
- # to think of.
logger.debug('cleaning socket file temp folder')
- shutil.rmtree(os.path.split(self.host)[0])
+
+ tempfolder = os.path.split(self.host)[0]
+ if os.path.isdir(tempfolder):
+ try:
+ shutil.rmtree(tempfolder)
+ except OSError:
+ logger.error('could not delete tmpfolder %s' % tempfolder)
def _get_openvpn_process(self):
# plist = [p for p in psutil.get_process_list() if p.name == "openvpn"]