logger.exception -> logger.error because logger.exception displays a stacktrace and it ain't relevant in any of these cases

This commit is contained in:
Alexandre Aubin 2021-02-02 03:57:33 +01:00
parent 071d8c4cbe
commit 10ba00affe
3 changed files with 8 additions and 8 deletions

View file

@ -104,16 +104,16 @@ def app_catalog(full=False, with_categories=False):
return {"apps": catalog["apps"]}
else:
return {"apps": catalog["apps"], "categories": catalog["categories"]}
def app_search(string):
"""
Return a dict of apps whose description or name match the search string
"""
# Retrieve a simple dict listing all apps
catalog_of_apps = app_catalog()
# Selecting apps according to a match in app name or description
for app in catalog_of_apps["apps"].items():
if not (re.search(string, app[0], flags=re.IGNORECASE) or
@ -2171,7 +2171,7 @@ def _get_git_last_commit_hash(repository, reference='HEAD'):
.format(repository, reference)
commit = check_output(cmd)
except subprocess.CalledProcessError:
logger.exception("unable to get last commit from %s", repository)
logger.error("unable to get last commit from %s", repository)
raise ValueError("Unable to get last commit with git")
else:
return commit.strip()

View file

@ -703,7 +703,7 @@ class BackupManager():
except:
abs_tmp_app_dir = os.path.join(self.work_dir, 'apps/', app)
shutil.rmtree(abs_tmp_app_dir, ignore_errors=True)
logger.exception(m18n.n('backup_app_failed', app=app))
logger.error(m18n.n('backup_app_failed', app=app))
self.targets.set_result("apps", app, "Error")
else:
# Add app info
@ -945,7 +945,7 @@ class RestoreManager():
if system_part not in self.info['system'] or\
'paths' not in self.info['system'][system_part] or\
len(self.info['system'][system_part]['paths']) == 0:
logger.exception(m18n.n('restore_hook_unavailable', part=system_part))
logger.error(m18n.n('restore_hook_unavailable', part=system_part))
self.targets.set_result("system", system_part, "Skipped")
continue
@ -1392,7 +1392,7 @@ class RestoreManager():
env=env_dict)[0]
except:
msg = m18n.n('restore_app_failed', app=app_instance_name)
logger.exception(msg)
logger.error(msg)
operation_logger.error(msg)
if msettings.get('interface') != 'api':

View file

@ -148,7 +148,7 @@ def tools_adminpw(new_password, check_strength=True):
try:
ldap.update("cn=admin", {"userPassword": [new_hash], })
except:
logger.exception('unable to change admin password')
logger.error('unable to change admin password')
raise YunohostError('admin_password_change_failed')
else:
# Write as root password