mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
use moulinette instead of os.system, os.chown, os.chmod
This commit is contained in:
parent
dcb01a249b
commit
607a22de00
2 changed files with 6 additions and 9 deletions
|
@ -34,7 +34,7 @@ from datetime import datetime
|
|||
|
||||
from moulinette import m18n
|
||||
from moulinette.utils.log import getActionLogger
|
||||
from moulinette.utils.filesystem import read_file
|
||||
from moulinette.utils.filesystem import read_file, chown, chmod
|
||||
|
||||
from yunohost.vendor.acme_tiny.acme_tiny import get_crt as sign_certificate
|
||||
from yunohost.utils.error import YunohostError, YunohostValidationError
|
||||
|
@ -719,11 +719,8 @@ def _generate_key(destination_path):
|
|||
|
||||
|
||||
def _set_permissions(path, user, group, permissions):
|
||||
uid = pwd.getpwnam(user).pw_uid
|
||||
gid = grp.getgrnam(group).gr_gid
|
||||
|
||||
os.chown(path, uid, gid)
|
||||
os.chmod(path, permissions)
|
||||
chown(path, user, group)
|
||||
chmod(path, permissions)
|
||||
|
||||
|
||||
def _enable_certificate(domain, new_cert_folder):
|
||||
|
|
|
@ -5,7 +5,7 @@ import random
|
|||
import requests
|
||||
from typing import List
|
||||
|
||||
from moulinette.utils.filesystem import read_file
|
||||
from moulinette.utils.filesystem import read_file, mkdir, rm
|
||||
|
||||
from yunohost.diagnosis import Diagnoser
|
||||
from yunohost.domain import domain_list
|
||||
|
@ -46,8 +46,8 @@ class MyDiagnoser(Diagnoser):
|
|||
domains_to_check.append(domain)
|
||||
|
||||
self.nonce = "".join(random.choice("0123456789abcedf") for i in range(16))
|
||||
os.system("rm -rf /tmp/.well-known/ynh-diagnosis/")
|
||||
os.system("mkdir -p /tmp/.well-known/ynh-diagnosis/")
|
||||
rm("/tmp/.well-known/ynh-diagnosis/", recursive=True, force=True)
|
||||
mkdir("/tmp/.well-known/ynh-diagnosis/", parents=True)
|
||||
os.system("touch /tmp/.well-known/ynh-diagnosis/%s" % self.nonce)
|
||||
|
||||
if not domains_to_check:
|
||||
|
|
Loading…
Add table
Reference in a new issue