summaryrefslogtreecommitdiff
path: root/src/leap/services
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-03-13 10:21:15 -0300
committerTomás Touceda <chiiph@leap.se>2013-03-13 10:21:15 -0300
commit12d2835c7d1f3c3d11eaa587b2196c104e6859e7 (patch)
tree47dd63b13781ae3d54fc3e26669d17489b5af7a0 /src/leap/services
parentb15f28b73afc31fd4176bee1a615e4095b0f4479 (diff)
Add mkdir_p method to util.files
Diffstat (limited to 'src/leap/services')
-rw-r--r--src/leap/services/eip/eipbootstrapper.py12
-rw-r--r--src/leap/services/eip/providerbootstrapper.py10
2 files changed, 4 insertions, 18 deletions
diff --git a/src/leap/services/eip/eipbootstrapper.py b/src/leap/services/eip/eipbootstrapper.py
index 84a309cb..3e4e2063 100644
--- a/src/leap/services/eip/eipbootstrapper.py
+++ b/src/leap/services/eip/eipbootstrapper.py
@@ -22,7 +22,6 @@ EIP bootstrapping
import requests
import logging
import os
-import errno
from PySide import QtGui, QtCore
@@ -31,7 +30,7 @@ from leap.config.providerconfig import ProviderConfig
from leap.services.eip.eipconfig import EIPConfig
from leap.util.check import leap_assert, leap_assert_type
from leap.util.checkerthread import CheckerThread
-from leap.util.files import check_and_fix_urw_only, get_mtime
+from leap.util.files import check_and_fix_urw_only, get_mtime, mkdir_p
from leap.util.request_helpers import get_content
logger = logging.getLogger(__name__)
@@ -184,14 +183,7 @@ class EIPBootstrapper(QtCore.QObject):
# TODO: check certificate validity
- try:
- os.makedirs(os.path.dirname(client_cert_path))
- except OSError as e:
- if e.errno == errno.EEXIST and \
- os.path.isdir(os.path.dirname(client_cert_path)):
- pass
- else:
- raise
+ mkdir_p(os.path.dirname(client_cert_path))
with open(client_cert_path, "w") as f:
f.write(client_cert)
diff --git a/src/leap/services/eip/providerbootstrapper.py b/src/leap/services/eip/providerbootstrapper.py
index 4fdd9b8d..df56110e 100644
--- a/src/leap/services/eip/providerbootstrapper.py
+++ b/src/leap/services/eip/providerbootstrapper.py
@@ -31,7 +31,7 @@ from PySide import QtGui, QtCore
from leap.config.providerconfig import ProviderConfig
from leap.util.check import leap_assert, leap_assert_type
from leap.util.checkerthread import CheckerThread
-from leap.util.files import check_and_fix_urw_only, get_mtime
+from leap.util.files import check_and_fix_urw_only, get_mtime, mkdir_p
from leap.util.request_helpers import get_content
logger = logging.getLogger(__name__)
@@ -271,13 +271,7 @@ class ProviderBootstrapper(QtCore.QObject):
cert_dir = os.path.dirname(cert_path)
- try:
- os.makedirs(cert_dir)
- except OSError as e:
- if e.errno == errno.EEXIST and os.path.isdir(cert_dir):
- pass
- else:
- raise
+ mkdir_p(cert_dir)
with open(cert_path, "w") as f:
f.write(res.content)