Bug 1043772

Summary: LDAP group creation should fail with an appropriate error message if LDAP is not configured
Product: [Retired] Beaker Reporter: xjia <xjia>
Component: command lineAssignee: Anwesha Chatterjee <achatter>
Status: CLOSED CURRENTRELEASE QA Contact: Dan Callaghan <dcallagh>
Severity: low Docs Contact:
Priority: low    
Version: 0.15CC: achatter, dcallagh, ebaak, qwan, rjoost, tools-bugs
Target Milestone: 24.4Keywords: EasyFix, Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-03 03:57:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description xjia 2013-12-17 06:26:02 UTC
Description of problem:
If server does not configure LDAP, user should not allow to create LDAP group.

Version-Release number of selected component (if applicable):
develop

How reproducible:
100%

Steps to Reproduce:
1.bkr group-create --root-password="Test@2013"  --ldap --display-name="test12" test12
2.
3.

Actual results:
[root@dhcp-65-142 ~]# bkr group-create --root-password="Test@2013"  --ldap --display-name="test12" test12
XML-RPC fault: <type 'exceptions.TypeError'>:argument 1 must be string, not None


Expected results:
Give some information like “LDAP group cannot be created, please contact with administrator” instead of faulting.


Additional info:

Comment 3 Dan Callaghan 2017-01-12 02:33:51 UTC
Possibly we already fixed this case in the new HTTP APIs for groups, need to check.

Comment 4 Anwesha Chatterjee 2017-07-07 06:21:08 UTC
Upon running steps to reproduce, the client throws the following exception:

XML-RPC fault: <type 'exceptions.AssertionError'>:

And I get this stacktrace error on the server:

Traceback (most recent call last):
  File "/root/beaker/Server/bkr/server/xmlrpccontroller.py", line 59, in RPC2
    response = self.process_rpc(method,params)
  File "/root/beaker/Server/bkr/server/xmlrpccontroller.py", line 44, in process_rpc
    response = obj(*params)
  File "<string>", line 2, in create
  File "/root/beaker/Server/bkr/server/identity.py", line 288, in require
    return func(*args, **kwargs)
  File "<string>", line 3, in create
  File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 356, in expose
    *args, **kw)
  File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 244, in _expose
    @abstract()
  File "<generated code>", line 0, in _expose
  File "/usr/lib/python2.6/site-packages/peak/rules/core.py", line 153, in __call__
    return self.body(*args, **kw)
  File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 390, in <lambda>
    fragment, options, args, kw)))
  File "/usr/lib/python2.6/site-packages/turbogears/controllers.py", line 425, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/usr/lib/python2.6/site-packages/turbogears/errorhandling.py", line 77, in try_call
    return func(self, *args, **kw)
  File "/root/beaker/Server/bkr/server/group.py", line 175, in create
    group.refresh_ldap_members()
  File "/root/beaker/Server/bkr/server/model/identity.py", line 815, in refresh_ldap_members
    assert get('identity.ldap.enabled', False)
AssertionError

Comment 5 Anwesha Chatterjee 2017-07-13 04:39:50 UTC
https://gerrit.beaker-project.org/#/c/5733/

Comment 7 Dan Callaghan 2017-09-19 04:56:55 UTC
Verified by temporarily setting:

identity.ldap.enabled=False

on the server and then trying to create an LDAP group:

$ bkr group-create --ldap ldaptest
XML-RPC fault: <class 'bkr.common.bexceptions.BX'>:LDAP is not enabled

Comment 8 Dan Callaghan 2017-10-03 03:57:50 UTC
Beaker 24.4 has been released.