From 10ba00affe950f62eaef296869b5ad90c67c3d9f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 2 Feb 2021 03:57:33 +0100 Subject: [PATCH] logger.exception -> logger.error because logger.exception displays a stacktrace and it ain't relevant in any of these cases --- src/yunohost/app.py | 8 ++++---- src/yunohost/backup.py | 6 +++--- src/yunohost/tools.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 2171f2d3d..bb3e9a285 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -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() diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 870e48476..455c39f84 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -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': diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index ae8b3443e..405143395 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -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