some improvements

This commit is contained in:
Kay0u 2021-12-29 22:45:25 +01:00
parent f92c88aff7
commit 2cc09aca91
No known key found for this signature in database
GPG key ID: AE1DCADB6415A156
3 changed files with 22 additions and 26 deletions

View file

@ -38,11 +38,11 @@ class MyMigration(Migration):
# Ignore the "www.conf" (default stuff, probably don't want to touch it ?)
php70_pool_files = [f for f in php70_pool_files if f != "www.conf"]
for f in php70_pool_files:
for pf in php70_pool_files:
# Copy the files to the php7.3 pool
src = "{}/{}".format(PHP70_POOLS, f)
dest = "{}/{}".format(PHP73_POOLS, f)
src = "{}/{}".format(PHP70_POOLS, pf)
dest = "{}/{}".format(PHP73_POOLS, pf)
copy2(src, dest)
# Replace the socket prefix if it's found
@ -56,17 +56,17 @@ class MyMigration(Migration):
c = "sed -i '1i {}' {}".format(MIGRATION_COMMENT, dest)
os.system(c)
app_id = os.path.basename(f)[: -len(".conf")]
app_id = os.path.basename(pf)[: -len(".conf")]
if _is_installed(app_id):
_patch_legacy_php_versions_in_settings(
"/etc/yunohost/apps/%s/" % app_id
)
nginx_conf_files = glob.glob("/etc/nginx/conf.d/*.d/%s.conf" % app_id)
for f in nginx_conf_files:
for nf in nginx_conf_files:
# Replace the socket prefix if it's found
c = "sed -i -e 's@{}@{}@g' {}".format(
PHP70_SOCKETS_PREFIX, PHP73_SOCKETS_PREFIX, f
PHP70_SOCKETS_PREFIX, PHP73_SOCKETS_PREFIX, nf
)
os.system(c)

View file

@ -587,7 +587,7 @@ def service_regen_conf(
if name not in services.keys():
raise YunohostValidationError("service_unknown", service=name)
if names is []:
if names == []:
names = list(services.keys())
logger.warning(m18n.n("service_regen_conf_is_deprecated"))

View file

@ -236,28 +236,24 @@ def tools_postinstall(
# If this is a nohost.me/noho.st, actually check for availability
if not ignore_dyndns and is_yunohost_dyndns_domain(domain):
# (Except if the user explicitly said he/she doesn't care about dyndns)
if ignore_dyndns:
dyndns = False
# Check if the domain is available...
else:
try:
available = _dyndns_available(domain)
# If an exception is thrown, most likely we don't have internet
# connectivity or something. Assume that this domain isn't manageable
# and inform the user that we could not contact the dyndns host server.
except Exception:
logger.warning(
m18n.n(
"dyndns_provider_unreachable", provider="dyndns.yunohost.org"
)
try:
available = _dyndns_available(domain)
# If an exception is thrown, most likely we don't have internet
# connectivity or something. Assume that this domain isn't manageable
# and inform the user that we could not contact the dyndns host server.
except Exception:
logger.warning(
m18n.n(
"dyndns_provider_unreachable", provider="dyndns.yunohost.org"
)
)
if available:
dyndns = True
# If not, abort the postinstall
else:
raise YunohostValidationError("dyndns_unavailable", domain=domain)
if available:
dyndns = True
# If not, abort the postinstall
else:
raise YunohostValidationError("dyndns_unavailable", domain=domain)
else:
dyndns = False