Project

General

Profile

Bug #48642

Erreur migrate _schemas assert len(perm.roles.all()) == 1

Added by Emmanuel Cazenave 18 days ago. Updated 17 days ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
18 Nov 2020
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["/home/cazino/envs/publik-env-py3/bin/authentic-multitenant-manage", "migrate_schemas"], "delta": "0:00:01.814881", "end": "2020-11-18 10:46:51.374396", "msg": "non-zero return code", "rc": 1, "start": "2020-11-18 10:46:49.559515", "stderr": "/home/cazino/src/authentic/src/authentic2/settings.py:192: UserWarning: journald will not be used directly, please install python-systemd\n  'authentic2_auth_oidc.authenticators.OIDCAuthenticator',\nTraceback (most recent call last):\n  File \"/home/cazino/src/authentic/authentic2-ctl\", line 21, in <module>\n    execute_from_command_line(sys.argv[:1] + argv)\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/__init__.py\", line 364, in execute_from_command_line\n    utility.execute()\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/__init__.py\", line 356, in execute\n    self.fetch_command(subcommand).run_from_argv(self.argv)\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/base.py\", line 283, in run_from_argv\n    self.execute(*args, **cmd_options)\n  File \"/home/cazino/src/hobo/hobo/agent/authentic2/apps.py\", line 45, in new_execute\n    return old_execute(self, *args, **kwargs)\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/base.py\", line 330, in execute\n    output = self.handle(*args, **options)\n  File \"/home/cazino/src/hobo/hobo/multitenant/management/commands/migrate_schemas.py\", line 71, in handle\n    self.run_migrations(tenant, settings.TENANT_APPS)\n  File \"/home/cazino/src/hobo/hobo/multitenant/management/commands/migrate_schemas.py\", line 89, in run_migrations\n    command.execute(*self.args, **self.options)\n  File \"/home/cazino/src/hobo/hobo/agent/authentic2/apps.py\", line 45, in new_execute\n    return old_execute(self, *args, **kwargs)\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/base.py\", line 330, in execute\n    output = self.handle(*args, **options)\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/commands/migrate.py\", line 227, in handle\n    self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan,\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/sql.py\", line 53, in emit_post_migrate_signal\n    **kwargs\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/dispatch/dispatcher.py\", line 193, in send\n    for receiver in self._live_receivers(sender)\n  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/dispatch/dispatcher.py\", line 193, in <listcomp>\n    for receiver in self._live_receivers(sender)\n  File \"/home/cazino/src/authentic/src/authentic2/a2_rbac/signal_handlers.py\", line 108, in post_migrate_update_role_admins\n    update_user_admin_roles_permission()\n  File \"/home/cazino/src/authentic/src/authentic2/a2_rbac/management.py\", line 169, in update_user_admin_roles_permission\n    assert len(perm.roles.all()) == 1\nAssertionError", "stderr_lines": ["/home/cazino/src/authentic/src/authentic2/settings.py:192: UserWarning: journald will not be used directly, please install python-systemd", "  'authentic2_auth_oidc.authenticators.OIDCAuthenticator',", "Traceback (most recent call last):", "  File \"/home/cazino/src/authentic/authentic2-ctl\", line 21, in <module>", "    execute_from_command_line(sys.argv[:1] + argv)", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/__init__.py\", line 364, in execute_from_command_line", "    utility.execute()", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/__init__.py\", line 356, in execute", "    self.fetch_command(subcommand).run_from_argv(self.argv)", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/base.py\", line 283, in run_from_argv", "    self.execute(*args, **cmd_options)", "  File \"/home/cazino/src/hobo/hobo/agent/authentic2/apps.py\", line 45, in new_execute", "    return old_execute(self, *args, **kwargs)", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/base.py\", line 330, in execute", "    output = self.handle(*args, **options)", "  File \"/home/cazino/src/hobo/hobo/multitenant/management/commands/migrate_schemas.py\", line 71, in handle", "    self.run_migrations(tenant, settings.TENANT_APPS)", "  File \"/home/cazino/src/hobo/hobo/multitenant/management/commands/migrate_schemas.py\", line 89, in run_migrations", "    command.execute(*self.args, **self.options)", "  File \"/home/cazino/src/hobo/hobo/agent/authentic2/apps.py\", line 45, in new_execute", "    return old_execute(self, *args, **kwargs)", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/base.py\", line 330, in execute", "    output = self.handle(*args, **options)", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/commands/migrate.py\", line 227, in handle", "    self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan,", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/core/management/sql.py\", line 53, in emit_post_migrate_signal", "    **kwargs", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/dispatch/dispatcher.py\", line 193, in send", "    for receiver in self._live_receivers(sender)", "  File \"/home/cazino/envs/publik-env-py3/lib/python3.7/site-packages/django/dispatch/dispatcher.py\", line 193, in <listcomp>", "    for receiver in self._live_receivers(sender)", "  File \"/home/cazino/src/authentic/src/authentic2/a2_rbac/signal_handlers.py\", line 108, in post_migrate_update_role_admins", "    update_user_admin_roles_permission()", "  File \"/home/cazino/src/authentic/src/authentic2/a2_rbac/management.py\", line 169, in update_user_admin_roles_permission", "    assert len(perm.roles.all()) == 1", "AssertionError"], "stdout": "", "stdout_lines": []}

De façon amusante, en relançant le migrate_schemas une deuxième fois, ça passe.

Il se pourrait que ce soit récurrent, dixit Thomas J qui a souvent une erreur a2 qui arrive une première fois et qui passe en relançant ansible (mais pas sûr que ce soit cette trace précise à tous les coups).

History

#2

Updated by Valentin Deniaud 18 days ago

Il y avait un bug de création de permissions en double (en bref), c'est résolu mais pour réparer la db il faut taper un authentic2-multitenant-manage check-and-repair --repair --noinput (je crois).

#3

Updated by Benjamin Dauvergne 17 days ago

De façon amusante, en relançant le migrate_schemas une deuxième fois, ça passe.

Oui c'est le résultat d'une optimisation dans migrate_schemas: le bug est dans un post_migrate et migrate_schemas n'exécute pas du tout les migrations ni les signaux post_migrate si elles sont toutes déjà appliquées.

Also available in: Atom PDF