From ef44abae6e7e557855f0ece47e5fa4725ed97c14 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 29 Dec 2021 22:45:25 +0100 Subject: [PATCH] some improvements --- .../0016_php70_to_php73_pools.py | 12 +++---- src/yunohost/service.py | 2 +- src/yunohost/tools.py | 34 ++++++++----------- 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/yunohost/data_migrations/0016_php70_to_php73_pools.py b/src/yunohost/data_migrations/0016_php70_to_php73_pools.py index fed96c9c8..570e63ea4 100644 --- a/src/yunohost/data_migrations/0016_php70_to_php73_pools.py +++ b/src/yunohost/data_migrations/0016_php70_to_php73_pools.py @@ -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) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index 4f453dfe9..8a7b146b1 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -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")) diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index 679b4d16e..a0411c69e 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -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