Don't allow failure for invalid python3 code + fix unsued variables

This commit is contained in:
Alexandre Aubin 2021-01-02 20:40:51 +01:00
parent 58522d4105
commit de126fcdce
5 changed files with 4 additions and 5 deletions

View file

@ -14,7 +14,6 @@ lint37:
invalidcode37:
stage: lint
image: "before-install"
allow_failure: true
needs: []
script:
- tox -e py37-invalidcode

View file

@ -831,7 +831,7 @@ def app_install(operation_logger, app, label=None, args=None, no_remove_on_failu
logger.error(m18n.n("app_install_failed", app=app_id, error=error))
failure_message_with_debug_instructions = operation_logger.error(error)
# Something wrong happened in Yunohost's code (most probably hook_exec)
except Exception as e:
except Exception:
import traceback
error = m18n.n('unexpected_error', error="\n" + traceback.format_exc())
logger.error(m18n.n("app_install_failed", app=app_id, error=error))

View file

@ -1644,7 +1644,7 @@ class BackupMethod(object):
try:
subprocess.check_call(["mount", "--rbind", src, dest])
subprocess.check_call(["mount", "-o", "remount,ro,bind", dest])
except Exception as e:
except Exception:
logger.warning(m18n.n("backup_couldnt_bind", src=src, dest=dest))
# To check if dest is mounted, use /proc/mounts that
# escape spaces as \040

View file

@ -98,7 +98,7 @@ class MyMigration(Migration):
# Migrate old settings
migrate_legacy_permission_settings()
except Exception as e:
except Exception:
logger.warn(m18n.n("migration_0019_migration_failed_trying_to_rollback"))
os.system("systemctl stop slapd")
os.system("rm -r /etc/ldap/slapd.d") # To be sure that we don't keep some part of the old config

View file

@ -22,7 +22,7 @@ class SetupGroupPermissions():
try:
objects = ldap.search(target + ",dc=yunohost,dc=org")
# ldap search will raise an exception if no corresponding object is found >.> ...
except Exception as e:
except Exception:
logger.debug("%s does not exist, no need to delete it" % target)
return