Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1664952

Summary: dsidm issues
Product: Red Hat Enterprise Linux 8 Reporter: Amita Sharma <amsharma>
Component: 389-ds-baseAssignee: mreynolds
Status: CLOSED NOTABUG QA Contact: RHDS QE <ds-qe-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.1CC: lkrispen, nkinder, pasik, spichugi, tbordaz, vashirov
Target Milestone: rcFlags: vashirov: mirror+
Target Release: 8.0   
Hardware: x86_64   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-27 13:59:56 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:
Bug Depends On: 1683259    
Bug Blocks:    

Description Amita Sharma 2019-01-10 06:49:02 UTC
Description of problem:
dsidm issues - This bug is found while testing - https://bugzilla.redhat.com/show_bug.cgi?id=1654581

Version-Release number of selected component (if applicable):
389-ds-base-1.4.0.20-4.module+el8+2624+8b7e87b9.x86_64

How reproducible:
Always

Steps to Reproduce:
1. we don't have -b option in the help though we have to use it while creating the user -
[root@server-rhel8 ds]# dsidm slapd-slapd-6 user create --help
usage: dsidm instance user create [-h] [--uid [UID]] [--cn [CN]]
                                  [--displayName [DISPLAYNAME]]
                                  [--uidNumber [UIDNUMBER]]
                                  [--gidNumber [GIDNUMBER]]
                                  [--homeDirectory [HOMEDIRECTORY]]

optional arguments:
  -h, --help            show this help message and exit
  --uid [UID]           Value of uid
  --cn [CN]             Value of cn
  --displayName [DISPLAYNAME]
                        Value of displayName
  --uidNumber [UIDNUMBER]
                        Value of uidNumber
  --gidNumber [GIDNUMBER]
                        Value of gidNumber
  --homeDirectory [HOMEDIRECTORY]
                        Value of homeDirectory


[root@server-rhel8 ds]# dsidm  -v slapd-slapd-6 user create --uid tuser7 --cn tuser --displayName tuser --uidNumber 1007 --gidNumber 1007  --homeDirectory /home/tuser7
DEBUG: The 389 Directory Server Identity Manager
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: dsrc path: /root/.dsrc
DEBUG: dsrc instances: []
DEBUG: dsrc no such section slapd-slapd-6
DEBUG: Called with: Namespace(basedn=None, binddn=None, bindpw=None, cn='tuser', displayName='tuser', func=<function create at 0x7fb045711b70>, gidNumber='1007', homeDirectory='/home/tuser7', instance='slapd-slapd-6', json=False, prompt=False, pwdfile=None, starttls=False, uid='tuser7', uidNumber='1007', verbose=True)
DEBUG: Instance details: {'uri': 'slapd-slapd-6', 'basedn': None, 'binddn': None, 'saslmech': None, 'tls_cacertdir': None, 'tls_cert': None, 'tls_key': None, 'tls_reqcert': 1, 'starttls': False, 'args': {'ldapurl': 'slapd-slapd-6', 'root-dn': None}}
ERROR: Must provide a basedn!

[root@server-rhel8 ds]# dsidm -b "dc=example,dc=com" slapd-server-rhel8 user create --uid tuser7 --cn tuser --displayName tuser --uidNumber 1007 --gidNumber 1007  --homeDirectory /home/tuser7
Sucessfully created tuser7

---------------------
2. Now there is another issue, when you specify wrong DN 

[root@server-rhel8 ds]# dsidm -b "dc=example,dc=com"  -v slapd-slapd-6 user create --uid tuser7 --cn tuser --displayName tuser --uidNumber 1007 --gidNumber 1007  --homeDirectory /home/tuser7
DEBUG: The 389 Directory Server Identity Manager
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: dsrc path: /root/.dsrc
DEBUG: dsrc instances: []
DEBUG: dsrc no such section slapd-slapd-6
DEBUG: Called with: Namespace(basedn='dc=example,dc=com', binddn=None, bindpw=None, cn='tuser', displayName='tuser', func=<function create at 0x7f53a5d6bae8>, gidNumber='1007', homeDirectory='/home/tuser7', instance='slapd-slapd-6', json=False, prompt=False, pwdfile=None, starttls=False, uid='tuser7', uidNumber='1007', verbose=True)
DEBUG: Instance details: {'uri': 'slapd-slapd-6', 'basedn': 'dc=example,dc=com', 'binddn': None, 'saslmech': None, 'tls_cacertdir': None, 'tls_cert': None, 'tls_key': None, 'tls_reqcert': 1, 'starttls': False, 'args': {'ldapurl': 'slapd-slapd-6', 'root-dn': None}}
DEBUG: Could not find configuration for instance: slapd-slapd-6
Traceback (most recent call last):
  File "/usr/sbin/dsidm", line 124, in <module>
    inst = connect_instance(dsrc_inst=dsrc_inst, verbose=args.verbose, args=args)
  File "/usr/lib/python3.6/site-packages/lib389/cli_base/__init__.py", line 99, in connect_instance
    raise ValueError("Could not find configuration for instance: " + dsargs['ldapurl'])
ValueError: Could not find configuration for instance: slapd-slapd-6
ERROR: Error: Could not find configuration for instance: slapd-slapd-6
----------------

3. And a traceback if the user already exists
[root@server-rhel8 ds]# dsidm -b "dc=example,dc=com"  -v slapd-server-rhel8 user create --uid tuser7 --cn tuser --displayName tuser --uidNumber 1007 --gidNumber 1007  --homeDirectory /home/tuser7
DEBUG: The 389 Directory Server Identity Manager
DEBUG: Inspired by works of: ITS, The University of Adelaide
DEBUG: dsrc path: /root/.dsrc
DEBUG: dsrc instances: []
DEBUG: dsrc no such section slapd-server-rhel8
DEBUG: Called with: Namespace(basedn='dc=example,dc=com', binddn=None, bindpw=None, cn='tuser', displayName='tuser', func=<function create at 0x7fe1850c6ae8>, gidNumber='1007', homeDirectory='/home/tuser7', instance='slapd-server-rhel8', json=False, prompt=False, pwdfile=None, starttls=False, uid='tuser7', uidNumber='1007', verbose=True)
DEBUG: Instance details: {'uri': 'slapd-server-rhel8', 'basedn': 'dc=example,dc=com', 'binddn': None, 'saslmech': None, 'tls_cacertdir': None, 'tls_cert': None, 'tls_key': None, 'tls_reqcert': 1, 'starttls': False, 'args': {'ldapurl': 'slapd-server-rhel8', 'root-dn': None}}
DEBUG: Allocate <class 'lib389.DirSrv'> with ldapi://%2fvar%2frun%2fslapd-server-rhel8.socket
INFO: Allocate <class 'lib389.DirSrv'> with %2fvar%2frun%2fslapd-server-rhel8.socket
DEBUG: Allocate <class 'lib389.DirSrv'> with server-rhel8.example.com:389
INFO: Allocate <class 'lib389.DirSrv'> with server-rhel8.example.com:389
DEBUG: Allocate <class 'lib389.DirSrv'> with ldapi://%2fvar%2frun%2fslapd-server-rhel8.socket
INFO: Allocate <class 'lib389.DirSrv'> with %2fvar%2frun%2fslapd-server-rhel8.socket
DEBUG: Allocate <class 'lib389.DirSrv'> with server-rhel8.example.com:389
INFO: Allocate <class 'lib389.DirSrv'> with server-rhel8.example.com:389
DEBUG: open(): Connecting to uri ldapi://%2fvar%2frun%2fslapd-server-rhel8.socket
DEBUG: Using dirsrv ca certificate /etc/dirsrv/slapd-slapd-server-rhel8
DEBUG: Using external ca certificate /etc/dirsrv/slapd-slapd-server-rhel8
DEBUG: Using external ca certificate /etc/dirsrv/slapd-slapd-server-rhel8
DEBUG: Using certificate policy 1
DEBUG: ldap.OPT_X_TLS_REQUIRE_CERT = 1
INFO: open(): Using root autobind ...
INFO: open(): bound as None
DEBUG: Checking "None" under ou=people,dc=example,dc=com : {'uid': 'tuser7', 'cn': 'tuser', 'displayName': 'tuser', 'uidNumber': '1007', 'gidNumber': '1007', 'homeDirectory': '/home/tuser7'}
DEBUG: Using first property uid: tuser7 as rdn
DEBUG: Validated dn uid=tuser7,ou=people,dc=example,dc=com : valid_props {'uid': [b'tuser7'], 'cn': [b'tuser'], 'displayName': [b'tuser'], 'uidNumber': [b'1007'], 'gidNumber': [b'1007'], 'homeDirectory': [b'/home/tuser7']}
DEBUG: Entry uid=tuser7,ou=people,dc=example,dc=com already exists
Traceback (most recent call last):
  File "/usr/sbin/dsidm", line 125, in <module>
    result = args.func(inst, dsrc_inst['basedn'], log, args)
  File "/usr/lib/python3.6/site-packages/lib389/cli_idm/user.py", line 43, in create
    _generic_create(inst, basedn, log.getChild('_generic_create'), MANY, kwargs, args)
  File "/usr/lib/python3.6/site-packages/lib389/cli_idm/__init__.py", line 108, in _generic_create
    o = mc.create(properties=kwargs)
  File "/usr/lib/python3.6/site-packages/lib389/_mapped_object.py", line 976, in create
    return co.create(rdn, properties, self._basedn)
  File "/usr/lib/python3.6/site-packages/lib389/_mapped_object.py", line 775, in create
    return self._create(rdn, properties, basedn, ensure=False)
  File "/usr/lib/python3.6/site-packages/lib389/_mapped_object.py", line 750, in _create
    raise ldap.ALREADY_EXISTS("Entry %s already exists" % dn)
ldap.ALREADY_EXISTS: Entry uid=tuser7,ou=people,dc=example,dc=com already exists
ERROR: Error: Entry uid=tuser7,ou=people,dc=example,dc=com already exists

Comment 2 mreynolds 2020-04-24 18:15:40 UTC
Upstream ticket:
https://pagure.io/389-ds-base/issue/51050

Comment 3 mreynolds 2020-04-27 13:59:56 UTC
There are no bug here.

Issue [1] - the basedn is a required parameter of dsidm, regardless of which subcommand you use.  This is correct although I can see where the confusion is coming from since the subcommand help does not list it, but the subcomanmd help is specific to the options needed for that subcommand.  To put things in perspective, you don't see the other required options needed by dsidm in the create user help either (e.g. bind DN and password).

Issue [2] - specifying the wrong instance name.  The tool is responding correctly, I'm not sure what is the problem here.

Issue [3] - user already exists.  The tool also correctly handles this case.

Closing bug..