← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1217017] Re: dependency injection fails to init domain-specific identity drivers

 

IMHO this is a MUST to get this fixed für the Juno release. Otherwise
the domain specific drivers features does not work at all. This can
easily be reproduce by configuring LDAP driver for the default domain
and SQL for a secondary domain like the one for Heat.

** Changed in: keystone
       Status: Incomplete => New

** Changed in: keystone
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1217017

Title:
  dependency injection fails to init domain-specific identity drivers

Status in OpenStack Identity (Keystone):
  Invalid

Bug description:
  File “/keystone/common/dependency.py” has a method named “requires”
  which is a decorator for the “Assignment” class of both files
  “/keystone/assignment/backends/ldap.py” and
  “/keystone/assignment/backends/sql.py”.

  File “/keystone/assignment/backends/ldap.py”:

  @dependency.requires('identity_api')
  class Assignment(assignment.Driver):

  File “/keystone/assignment/backends/sql.py”:

  @dependency.requires('identity_api')
  class Assignment(sql.Base, assignment.Driver):

  When I specify the following contents for file
  “/etc/keystone/domains/keystone.Default.conf” I am telling Keystone to
  use an SQL backend for the default domain:

  [assignment]
  driver = keystone.assignment.backends.sql.Assignment

  [identity]
  driver = keystone.identity.backends.sql.Identity

  [ldap]

  However, there is a problem with the following line in method requires
  of file “dependency.py”:

      def wrapper(self, *args, **kwargs):
          """Inject each dependency from the registry."""
          self.__wrapped_init__(*args, **kwargs)

          for dependency in self._dependencies:
              if dependency not in REGISTRY:
                  if dependency in _future_dependencies:
                      _future_dependencies[dependency] += [self]
                  else:
                      _future_dependencies[dependency] = [self]

                  continue

              setattr(self, dependency, REGISTRY[dependency])

  because it is passing arguments to the constructor of the Assignment
  class in file “/keystone/assignment/backends/sql.py” which extends the
  sql.Base class (i.e. class Base(object) of file
  “/keystone/common/sql/core.py“) that extends class “object” which does
  not accept any parameters for its constructor. It took me a full day
  to pin this one down.

  To get around this problem I added the following lines to class
  Base(object) of file “/keystone/common/sql/core.py“ in order to accept
  any number of parameters:

      def __init__(self, *args, **kwargs):
          super(Base, self).__init__()

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1217017/+subscriptions