added safe mkdir in utils, use utils.mkdir_safe() in backup
This commit is contained in:
@@ -106,6 +106,11 @@ def mkdir(path, mode, uid, gid):
|
||||
os.chmod(path, mode)
|
||||
os.chown(path, uid, gid)
|
||||
|
||||
def mkdir_safe(path, mode, uid, gid):
|
||||
"""Create a directory. Safe way (-p)"""
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(os.path.abspath(path), mode)
|
||||
mkdir(path, mode, uid, gid)
|
||||
|
||||
def make_password(length=16):
|
||||
"""Create a random password."""
|
||||
|
||||
Reference in New Issue
Block a user