Opened 2 years ago

Closed 21 months ago

#3371 closed defect (fixed)

LDAP user auth doc is out of date

Reported by: packadal Owned by:
Priority: major Milestone: 0.9.1
Version: 0.9.0b3 Keywords:
Cc:

Description (last modified by dustin)

The doc for LDAP user info states that

from buildbot.plugins import util
userInfoProvider = util.LdapUserInfo( [...])

is the way to use it, however this fails with:

exceptions.AttributeError: Unable to load buildbot.util:LdapUserInfo: No module named ldapuserinfos

By fiddling a bit I tried

from buildbot.www import ldapuserinfo
userInfoProvider = ldapuserinfo.LdapUserInfo([...])

which works long enough to get buildbot started, but the the web page only contains:

"internal error - see logs"

and the log says:

        Traceback (most recent call last):
          File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 1237, in unwindGenerator
            return _inlineCallbacks(None, gen, Deferred())
          File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
            result = g.send(result)
          File "/usr/lib/python2.6/site-packages/buildbot-0.9.0b3-py2.6.egg/buildbot/www/config.py", line 116, in renderIndex
            yield self.config['auth'].maybeAutoLogin(request)
          File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 1237, in unwindGenerator
            return _inlineCallbacks(None, gen, Deferred())
        --- <exception caught here> ---
          File "/usr/lib64/python2.6/site-packages/twisted/internet/defer.py", line 1099, in _inlineCallbacks
            result = g.send(result)
          File "/usr/lib/python2.6/site-packages/buildbot-0.9.0b3-py2.6.egg/buildbot/www/auth.py", line 110, in maybeAutoLogin
            header = request.getHeader(self.header)
          File "/usr/lib64/python2.6/site-packages/twisted/web/http.py", line 897, in getHeader
            value = self.requestHeaders.getRawHeaders(key)
          File "/usr/lib64/python2.6/site-packages/twisted/web/http_headers.py", line 234, in getRawHeaders
            return self._rawHeaders.get(name.lower(), default)
        exceptions.AttributeError: 'LdapUserInfo' object has no attribute 'lower'

[edited: formatting]

Change History (9)

comment:1 Changed 22 months ago by dustin

  • Description modified (diff)
  • Milestone changed from 0.9.0 to 0.9.1

comment:3 Changed 22 months ago by packadal

I tested with buildbot beta 6 (beta 7 seems tagged, but is not available via pip yet), and I get the exact same errors.

I guess the doc is in line with the beta 7 code, because the new bind_user and bin_pw do not exist in beta 6, I must still use bindUser and bindPw.

comment:4 Changed 22 months ago by rutsky

@packadal I see beta7 on PyPI: https://pypi.python.org/pypi/buildbot/0.9.0b7

I guess the doc is in line with the beta 7 code, because the new bind_user and bin_pw do not exist in beta 6, I must still use bindUser and bindPw.

No, code hasn't changed in recent releases, its an error in docs: should be bindUser, bindPw and buildbot.ldapuserinfo. @jaredgrubb just recently fixed these docs this in master branch.

@packadal, can you check that latest docs correspond to the code in aspects that you noticed? This part: http://docs.buildbot.net/latest/manual/cfg-www.html#buildbot.ldapuserinfo.LdapUserInfo

comment:5 Changed 22 months ago by packadal

Funny, I just searched for buildbot and it is not there: https://pypi.python.org/pypi?%3Aaction=search&term=buildbot-0.9.0b&submit=search

Also when I do pip search buildbot I get

buildbot                                  - The Continuous Integration Framework
  INSTALLED: 0.9.0b6 (latest)

Anyways, the parameter names are now correct, bindPw and bindUser.

However, the doc still states that the import should be from buildbot.plugins import util

Which still does not work.

comment:6 Changed 22 months ago by rutsky

Looks like this is an issue with PyPI package index: https://bitbucket.org/pypa/pypi/issues/326/some-packages-not-showing-up-when

However, the doc still states that the import should be from buildbot.plugins import util

Which still does not work.

It works for me:

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from buildbot.plugins import util
>>> util.LdapUserInfo
<class 'buildbot.www.ldapuserinfo.LdapUserInfo'>
>>> util.RemoteUserAuth
<class 'buildbot.www.auth.RemoteUserAuth'>
>>> util.AvatarGravatar
<class 'buildbot.www.avatar.AvatarGravatar'>
>>> util.GoogleAuth
<class 'buildbot.www.oauth2.GoogleAuth'>
>>> 

LdapUserInfo available as class in native Python module buildbot.ldapuserinfo and as a util plugin from buildbot.plugins.util.

Latter option (with buildbot.plugins) is a recommended way to use it.

@packadal, is using LdapUserInfo from util plugin doesn't work for you?

comment:7 Changed 22 months ago by packadal

I tried the native python way, and I still get the following error:

>>> from buildbot.plugins import util
>>> util.LdapUserInfo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/buildbot/plugins/db.py", line 240, in __getattr__
    raise AttributeError(str(err))
AttributeError: Unable to load buildbot.util:LdapUserInfo: No module named ldapuserinfos

I tried on another machine that has python 2.7 just in case, where I did a fresh install of buildbot, buildbot-www, buildbot-waterfall-view, buildbot-console-view all of those beta7, and I get the exact same error. (I also installed the required python3-ldap package, and tried installing the ldap3 package since it is the new name of python3-ldap)

Any ideas of what I could do to help you find what the issue is ?

comment:8 Changed 22 months ago by rutsky

Oh, this is also fixed in @jaredgrubb's PR: https://github.com/buildbot/buildbot/pull/2006/files#diff-9030ee1b7d992477393062826c5decfeL345

So complete fix is available only in master branch at this moment.

comment:9 Changed 21 months ago by rutsky

  • Resolution set to fixed
  • Status changed from new to closed

I'll close this, as it seems that this issue is resolved.

@packadal feel free to reopen, if it is not completely resolved.

Note: See TracTickets for help on using tickets.