backup: fix full backup restore postinstall calls that now need first username+fullname+password

This commit is contained in:
Alexandre Aubin 2023-02-08 22:46:03 +01:00
parent 024db62a1d
commit 48e488f89e
2 changed files with 9 additions and 3 deletions

View file

@ -32,6 +32,7 @@ from functools import reduce
from packaging import version
from moulinette import Moulinette, m18n
from moulinette.utils.text import random_ascii
from moulinette.utils.log import getActionLogger
from moulinette.utils.filesystem import (
read_file,
@ -936,7 +937,10 @@ class RestoreManager:
)
logger.debug("executing the post-install...")
tools_postinstall(domain, "Yunohost", True)
# Use a dummy password which is not gonna be saved anywhere
# because the next thing to happen should be that a full restore of the LDAP db will happen
tools_postinstall(domain, "admin", "Admin", password=random_ascii(70), ignore_dyndns=True, overwrite_root_password=False)
def clean(self):
"""

View file

@ -152,6 +152,7 @@ def tools_postinstall(
password,
ignore_dyndns=False,
force_diskspace=False,
overwrite_root_password=True,
):
from yunohost.dyndns import _dyndns_available
from yunohost.utils.dns import is_yunohost_dyndns_domain
@ -225,10 +226,11 @@ def tools_postinstall(
domain_add(domain, dyndns)
domain_main_domain(domain)
# First user
user_create(username, domain, password, admin=True, fullname=fullname)
# Update LDAP admin and create home dir
tools_rootpw(password)
if overwrite_root_password:
tools_rootpw(password)
# Enable UPnP silently and reload firewall
firewall_upnp("enable", no_refresh=True)