← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1217017] Re: Can't use sql as domain-specific driver

 

** Changed in: keystone
       Status: Fix Committed => Fix Released

-- 
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:
  Can't use sql as domain-specific driver

Status in OpenStack Identity (Keystone):
  Fix Released

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