mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #626 from YunoHost/ignore-self-conflict-during-change-url
[fix] app conflicting with itself during change_url
This commit is contained in:
commit
e293cdcd77
2 changed files with 5 additions and 2 deletions
|
@ -465,7 +465,7 @@ def app_change_url(operation_logger, auth, app, domain, path):
|
||||||
raise YunohostError("app_change_url_identical_domains", domain=domain, path=path)
|
raise YunohostError("app_change_url_identical_domains", domain=domain, path=path)
|
||||||
|
|
||||||
# Check the url is available
|
# Check the url is available
|
||||||
conflicts = _get_conflicting_apps(auth, domain, path)
|
conflicts = _get_conflicting_apps(auth, domain, path, ignore_app=app)
|
||||||
if conflicts:
|
if conflicts:
|
||||||
apps = []
|
apps = []
|
||||||
for path, app_id, app_label in conflicts:
|
for path, app_id, app_label in conflicts:
|
||||||
|
|
|
@ -226,13 +226,14 @@ def domain_cert_renew(auth, domain_list, force=False, no_checks=False, email=Fal
|
||||||
return yunohost.certificate.certificate_renew(auth, domain_list, force, no_checks, email, staging)
|
return yunohost.certificate.certificate_renew(auth, domain_list, force, no_checks, email, staging)
|
||||||
|
|
||||||
|
|
||||||
def _get_conflicting_apps(auth, domain, path):
|
def _get_conflicting_apps(auth, domain, path, ignore_app=None):
|
||||||
"""
|
"""
|
||||||
Return a list of all conflicting apps with a domain/path (it can be empty)
|
Return a list of all conflicting apps with a domain/path (it can be empty)
|
||||||
|
|
||||||
Keyword argument:
|
Keyword argument:
|
||||||
domain -- The domain for the web path (e.g. your.domain.tld)
|
domain -- The domain for the web path (e.g. your.domain.tld)
|
||||||
path -- The path to check (e.g. /coffee)
|
path -- The path to check (e.g. /coffee)
|
||||||
|
ignore_app -- An optional app id to ignore (c.f. the change_url usecase)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
domain, path = _normalize_domain_path(domain, path)
|
domain, path = _normalize_domain_path(domain, path)
|
||||||
|
@ -253,6 +254,8 @@ def _get_conflicting_apps(auth, domain, path):
|
||||||
if domain in apps_map:
|
if domain in apps_map:
|
||||||
# Loop through apps
|
# Loop through apps
|
||||||
for p, a in apps_map[domain].items():
|
for p, a in apps_map[domain].items():
|
||||||
|
if a["id"] == ignore_app:
|
||||||
|
continue
|
||||||
if path == p:
|
if path == p:
|
||||||
conflicts.append((p, a["id"], a["label"]))
|
conflicts.append((p, a["id"], a["label"]))
|
||||||
# We also don't want conflicts with other apps starting with
|
# We also don't want conflicts with other apps starting with
|
||||||
|
|
Loading…
Add table
Reference in a new issue