#51050 dsidm issues
Closed: wontfix by mreynolds. Opened by mreynolds.

Ticket was cloned from Red Hat Bugzilla (product Red Hat Enterprise Linux 8): Bug 1664952

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

Metadata Update from @mreynolds:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1664952

Metadata Update from @mreynolds:
- Issue assigned to mreynolds

-b does exist, arg parse has an issue where you need to associate the options to the nearest processor, and we set -b really early. So it's actually on the dsidm part, IE:

dsidm -b 'dn' inst action options ... --more --options --here

It's a quirk of python arg parse, and how and where it puts options :(

If we moved -b/-H and friends, we need to copy-paste them or macro somehow to attach them to every single command in the code base to have them there ...

Metadata Update from @firstyear:
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None

This bug is old and some of it is outdated, but there are some things in the bugzilla we should address. This issue is the clone of that effort/bugzilla...

Everything in the bugzilla is invalid or works correctly. Closing ticket...

Metadata Update from @mreynolds:
- Issue close_status updated to: invalid
- Issue status updated to: Closed (was: Open)

Commit 3def54de relates to this ticket

Commit 3def54d relates to this ticket

96184bced..60aa69828 389-ds-base-1.4.3 -> 389-ds-base-1.4.3

ae2a2a431..ba3a70463 389-ds-base-1.4.2 -> 389-ds-base-1.4.2

f3bd104d0..f26174060 389-ds-base-1.4.1 -> 389-ds-base-1.4.1

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/4103

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: invalid)

Metadata
Related Pull Requests