PEP formating

This commit is contained in:
Spitap
2022-09-15 11:32:57 +02:00
parent 53e3e3ec58
commit b0d56b3989
10 changed files with 120 additions and 86 deletions

View File

@@ -106,12 +106,14 @@ 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."""
return "".join(
@@ -188,7 +190,7 @@ def check_config_file(dest, interactive=False, upgrade=False, backup=False, rest
"You cannot restore an existing installation without a "
f"configuration file. (file : {dest} has not been found...", RED)
sys.exit(1)
printcolor(
"Configuration file {} not found, creating new one."
.format(dest), YELLOW)