mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add domains_remove bulk operation
This commit is contained in:
parent
7a52066f56
commit
1ad0979ace
2 changed files with 21 additions and 3 deletions
|
@ -274,6 +274,20 @@ def domains_regen(domains: List[str]):
|
|||
app_ssowatconf()
|
||||
_run_service_command("reload", "nginx")
|
||||
|
||||
# Used in tests to delete many domains at once.
|
||||
# The permissions/configuration are synchronized at the end of the entire operation.
|
||||
@is_unit_operation()
|
||||
def domains_remove(operation_logger, domains: List[str]):
|
||||
for domain in domains:
|
||||
domain_remove(domain, do_regen_conf=False)
|
||||
|
||||
domains_regen(domains)
|
||||
|
||||
from yunohost.hook import hook_callback
|
||||
for domain in domains:
|
||||
hook_callback("post_domain_remove", args=[domain])
|
||||
logger.success(m18n.n("domain_deleted"))
|
||||
|
||||
# Used in tests to create many domains at once.
|
||||
# The permissions/configuration are synchronized at the end of the entire operation.
|
||||
@is_unit_operation()
|
||||
|
@ -419,6 +433,7 @@ def domain_remove(
|
|||
force=False,
|
||||
dyndns_recovery_password=None,
|
||||
ignore_dyndns=False,
|
||||
do_regen_conf=True,
|
||||
):
|
||||
"""
|
||||
Delete domains
|
||||
|
@ -541,6 +556,10 @@ def domain_remove(
|
|||
rm(key_file, force=True)
|
||||
rm(f"{DOMAIN_SETTINGS_DIR}/{domain}.yml", force=True)
|
||||
|
||||
# We are in a bulk domains_remove so don't regen_conf immediately
|
||||
if not do_regen_conf:
|
||||
return
|
||||
|
||||
# Sometime we have weird issues with the regenconf where some files
|
||||
# appears as manually modified even though they weren't touched ...
|
||||
# There are a few ideas why this happens (like backup/restore nginx
|
||||
|
|
|
@ -6,7 +6,7 @@ import os
|
|||
|
||||
from .conftest import message, raiseYunohostError, get_test_apps_dir
|
||||
|
||||
from yunohost.domain import _get_maindomain, domain_add, domain_remove, domain_list, domains_add
|
||||
from yunohost.domain import _get_maindomain, domain_add, domain_remove, domain_list, domains_add, domains_remove
|
||||
from yunohost.user import user_create, user_list, user_delete, User, users_add
|
||||
from yunohost.authenticators.ldap_ynhuser import Authenticator, SESSION_FOLDER, short_hash
|
||||
from yunohost.app import app_install, app_remove, app_setting, app_ssowatconf, app_change_url
|
||||
|
@ -70,8 +70,7 @@ def teardown_module(module):
|
|||
|
||||
domainlist = domain_list()["domains"]
|
||||
domains = [ domain for domain in [ subdomain, secondarydomain ] if domain in domainlist ]
|
||||
for domain in domains:
|
||||
domain_remove(domain)
|
||||
domains_remove(domains)
|
||||
|
||||
def login(session, logged_as, logged_on=None):
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue