mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] kill all bare exceptions
This commit is contained in:
parent
5ac2355882
commit
97f26015c6
8 changed files with 23 additions and 23 deletions
|
@ -735,7 +735,7 @@ class BackupManager:
|
|||
}
|
||||
write_to_yaml("%s/permissions.yml" % settings_dir, this_app_permissions)
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
abs_tmp_app_dir = os.path.join(self.work_dir, "apps/", app)
|
||||
shutil.rmtree(abs_tmp_app_dir, ignore_errors=True)
|
||||
logger.error(m18n.n("backup_app_failed", app=app))
|
||||
|
@ -1507,7 +1507,7 @@ class RestoreManager:
|
|||
raise_on_error=True,
|
||||
env=env_dict,
|
||||
)[0]
|
||||
except:
|
||||
except Exception:
|
||||
msg = m18n.n("restore_app_failed", app=app_instance_name)
|
||||
logger.error(msg)
|
||||
operation_logger.error(msg)
|
||||
|
@ -1944,7 +1944,7 @@ class TarBackupMethod(BackupMethod):
|
|||
self._archive_file,
|
||||
"w:gz" if self._archive_file.endswith(".gz") else "w",
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
logger.debug(
|
||||
"unable to open '%s' for writing", self._archive_file, exc_info=1
|
||||
)
|
||||
|
@ -1995,7 +1995,7 @@ class TarBackupMethod(BackupMethod):
|
|||
self._archive_file,
|
||||
"r:gz" if self._archive_file.endswith(".gz") else "r",
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
logger.debug(
|
||||
"cannot open backup archive '%s'", self._archive_file, exc_info=1
|
||||
)
|
||||
|
@ -2466,7 +2466,7 @@ def backup_info(name, with_details=False, human_readable=False):
|
|||
with open(info_file) as f:
|
||||
# Retrieve backup info
|
||||
info = json.load(f)
|
||||
except:
|
||||
except Exception:
|
||||
logger.debug("unable to load '%s'", info_file, exc_info=1)
|
||||
raise YunohostError(
|
||||
"backup_archive_cant_retrieve_info_json", archive=archive_file
|
||||
|
@ -2552,7 +2552,7 @@ def backup_delete(name):
|
|||
for backup_file in files_to_delete:
|
||||
try:
|
||||
os.remove(backup_file)
|
||||
except:
|
||||
except Exception:
|
||||
logger.debug("unable to delete '%s'", backup_file, exc_info=1)
|
||||
logger.warning(m18n.n("backup_delete_error", path=backup_file))
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ def certificate_status(domain_list, full=False):
|
|||
try:
|
||||
_check_domain_is_ready_for_ACME(domain)
|
||||
status["ACME_eligible"] = True
|
||||
except:
|
||||
except Exception:
|
||||
status["ACME_eligible"] = False
|
||||
|
||||
del status["domain"]
|
||||
|
|
|
@ -182,7 +182,7 @@ def dyndns_subscribe(
|
|||
os.system("rm -f %s" % key_file)
|
||||
try:
|
||||
error = json.loads(r.text)["error"]
|
||||
except:
|
||||
except Exception:
|
||||
error = 'Server error, code: %s. (Message: "%s")' % (r.status_code, r.text)
|
||||
raise YunohostError("dyndns_registration_failed", error=error)
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ def firewall_upnp(action="status", no_refresh=False):
|
|||
try:
|
||||
# Remove old cron job
|
||||
os.remove("/etc/cron.d/yunohost-firewall")
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
action = "status"
|
||||
no_refresh = False
|
||||
|
@ -360,7 +360,7 @@ def firewall_upnp(action="status", no_refresh=False):
|
|||
try:
|
||||
# Remove cron job
|
||||
os.remove(UPNP_CRON_JOB)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
enabled = False
|
||||
if action == "status":
|
||||
|
@ -384,7 +384,7 @@ def firewall_upnp(action="status", no_refresh=False):
|
|||
try:
|
||||
# Select UPnP device
|
||||
upnpc.selectigd()
|
||||
except:
|
||||
except Exception:
|
||||
logger.debug("unable to select UPnP device", exc_info=1)
|
||||
enabled = False
|
||||
else:
|
||||
|
@ -396,7 +396,7 @@ def firewall_upnp(action="status", no_refresh=False):
|
|||
if upnpc.getspecificportmapping(port, protocol):
|
||||
try:
|
||||
upnpc.deleteportmapping(port, protocol)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
firewall["uPnP"][protocol + "_TO_CLOSE"] = []
|
||||
|
||||
|
@ -405,7 +405,7 @@ def firewall_upnp(action="status", no_refresh=False):
|
|||
if upnpc.getspecificportmapping(port, protocol):
|
||||
try:
|
||||
upnpc.deleteportmapping(port, protocol)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if not enabled:
|
||||
continue
|
||||
|
@ -419,7 +419,7 @@ def firewall_upnp(action="status", no_refresh=False):
|
|||
"yunohost firewall: port %d" % port,
|
||||
"",
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
logger.debug(
|
||||
"unable to add port %d using UPnP", port, exc_info=1
|
||||
)
|
||||
|
@ -488,7 +488,7 @@ def _get_ssh_port(default=22):
|
|||
m = searchf(r"^Port[ \t]+([0-9]+)$", "/etc/ssh/sshd_config", count=-1)
|
||||
if m:
|
||||
return int(m)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return default
|
||||
|
||||
|
|
|
@ -445,7 +445,7 @@ def _get_regenconf_infos():
|
|||
try:
|
||||
with open(REGEN_CONF_FILE, "r") as f:
|
||||
return yaml.load(f)
|
||||
except:
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
|
||||
|
@ -498,7 +498,7 @@ def _get_files_diff(orig_file, new_file, as_string=False, skip_header=True):
|
|||
try:
|
||||
next(diff)
|
||||
next(diff)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if as_string:
|
||||
|
@ -683,7 +683,7 @@ def _process_regen_conf(system_conf, new_conf=None, save=True):
|
|||
# Raise an exception if an os.stat() call on either pathname fails.
|
||||
# (os.stats returns a series of information from a file like type, size...)
|
||||
copy_succeed = os.path.samefile(system_conf, new_conf)
|
||||
except:
|
||||
except Exception:
|
||||
copy_succeed = False
|
||||
finally:
|
||||
if not copy_succeed:
|
||||
|
|
|
@ -673,7 +673,7 @@ def _get_services():
|
|||
try:
|
||||
with open("/etc/yunohost/services.yml", "r") as f:
|
||||
services = yaml.load(f) or {}
|
||||
except:
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
# some services are marked as None to remove them from YunoHost
|
||||
|
@ -807,7 +807,7 @@ def _get_journalctl_logs(service, number="all"):
|
|||
systemd_service, number
|
||||
)
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
import traceback
|
||||
|
||||
return (
|
||||
|
|
|
@ -157,7 +157,7 @@ def settings_set(key, value):
|
|||
if isinstance(value, str):
|
||||
try:
|
||||
value = int(value)
|
||||
except:
|
||||
except Exception:
|
||||
raise YunohostError(
|
||||
"global_settings_bad_type_for_setting",
|
||||
setting=key,
|
||||
|
|
|
@ -171,7 +171,7 @@ def tools_adminpw(new_password, check_strength=True):
|
|||
"userPassword": [new_hash],
|
||||
},
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
logger.error("unable to change admin password")
|
||||
raise YunohostError("admin_password_change_failed")
|
||||
else:
|
||||
|
@ -315,7 +315,7 @@ def tools_postinstall(
|
|||
# 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:
|
||||
except Exception:
|
||||
logger.warning(
|
||||
m18n.n("dyndns_provider_unreachable", provider=dyndns_provider)
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue