Project

General

Profile

Bug #7691

(multitenant) error in create_default_ou when running migrations

Added by Frédéric Péters about 4 years ago. Updated over 1 year ago.

Status:
Fermé
Priority:
Normal
Category:
-
Target version:
Start date:
29 Jun 2015
Due date:
% Done:

100%

Patch proposed:
No
Planning:
No

Description

  Applying saml.0014_auto_20150617_1216... OK
Traceback (most recent call last):
  File "/usr/lib/authentic2/manage.py", line 20, in <module>
    execute_from_command_line(sys.argv[:1] + argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_lin
e
    utility.execute()
  File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.7/dist-packages/hobo/multitenant/management/commands/migrate_schemas.py", line 25, in run_
from_argv
    super(MigrateSchemasCommand, self).run_from_argv(argv)
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__) 
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)  
  File "/usr/lib/python2.7/dist-packages/hobo/multitenant/management/commands/migrate_schemas.py", line 42, in handle
    self.run_migrations(tenant.schema_name, settings.TENANT_APPS)
  File "/usr/lib/python2.7/dist-packages/hobo/multitenant/management/commands/migrate_schemas.py", line 58, in run_migrations
    command.execute(*self.args, **defaults) 
  File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)  
  File "/usr/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 165, in handle
    emit_post_migrate_signal(created_models, self.verbosity, self.interactive, connection.alias)
  File "/usr/lib/python2.7/dist-packages/django/core/management/sql.py", line 268, in emit_post_migrate_signal
    using=db)
  File "/usr/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 198, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/usr/lib/python2.7/dist-packages/authentic2/a2_rbac/signal_handlers.py", line 29, in create_default_ou
    'name': _('Default organizational unit'),
  File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py", line 92, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 424, in get_or_create
    return self._create_object_from_params(lookup, params)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 465, in _create_object_from_params
    six.reraise(*exc_info)
  File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 457, in _create_object_from_params
    obj.save(force_insert=True, using=self.db)
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 339, in __exit__
    connection.commit()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 176, in commit
    self._commit()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 145, in _commit
    return self.connection.commit()
  File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 145, in _commit
    return self.connection.commit()
django.db.utils.IntegrityError: ERREUR:  une instruction insert ou update sur la table « a2_rbac_permission » viole la contrainte de clé
étrangère « a2_rb_operation_id_11500320079f32bc_fk_django_rbac_operation_id »
DETAIL:  La clé (operation_id)=(4) n'est pas présente dans la table « django_rbac_operation ».

(this is on authentic.dev.entrouvert.org)

Associated revisions

Revision 65571f44 (diff)
Added by Benjamin Dauvergne about 4 years ago

django_rbac: remove GlobalCache from get_operation() (fixes #7691)

It should separate cache from different tenants based on the current
request, but in commands there is no current request, so it does not work.
Another solution would be to deactivate the cache when there is no
request in the global context.

History

#1 Updated by Benjamin Dauvergne about 4 years ago

  • % Done changed from 0 to 100
  • Status changed from Nouveau to Résolu (à déployer)

#2 Updated by Benjamin Dauvergne over 3 years ago

  • Target version set to 2.2.0

#3 Updated by Benjamin Dauvergne over 3 years ago

  • Status changed from Résolu (à déployer) to Solution déployée

#4 Updated by Benjamin Dauvergne over 1 year ago

  • Status changed from Solution déployée to Fermé

Also available in: Atom PDF