Commit 101bbecd authored by Xavier Thompson's avatar Xavier Thompson

slapformat: WIP Add ensureDir utility

parent 8e0ce033
......@@ -28,6 +28,7 @@
from __future__ import annotations
import configparser
import errno
import ipaddress
import logging
import netifaces
......@@ -470,6 +471,16 @@ def call(args, raise_on_error=True):
return popen.returncode, result
def ensureDir(path, mode):
try:
os.makedirs(path, mode)
except OSError as e:
if e.errno == errno.EEXIST and os.path.isdir(path):
os.chmod(path, mode)
else:
raise
# Wrapping, Tracing & Dry-running
class WrappedModule(object):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment