#9310 ipa-trust-add with --range-type=ipa-ad-trust-posix fails while creating an ID range
Closed: fixed by rcritten. Opened by frenaud.

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

Please note that this Bug is private and may not be accessible as it contains confidential Red Hat customer information.

Description of problem:
ipa-trust-add with --range-type=ipa-ad-trust-posix fails while creating an ID range with below error : 
ipa -vvv trust-add --type=ad ad.test --admin admin.idm --password --range-type=ipa-ad-trust-posix
Version-Release number of selected component (if applicable):
RHEL 8.7 
ipa-server-4.9.10-6.module+el8.7.0+16405+581a7c1e.x86_64
How reproducible:
Create an IPA-AD trust with POSIX range type as below : 
$ date; ipa -vvv trust-add --type=ad ad.test --admin admin.idm --password --range-type=ipa-ad-trust-posix;date
Wed Jan 18 09:48:04 CET 2023
Actual results:
It fails with below error : 
body: b'{"result": null, "error": {"code": 903, "message": "an internal error has occurred", "data": {}, "name": "InternalError"}, "id": 0, "principal": "admin@AD.TEST", "version": "4.9.10"}'ipa: INFO: Response: {
    "error": {
        "code": 903,
        "data": {},
        "message": "an internal error has occurred",
        "name": "InternalError"
    },
    "id": 0,
    "principal": "admin@AD.TEST",
    "result": null,
    "version": "4.9.10"
}
ipa: ERROR: une erreur interne est survenue
Expected results:
Trust get created successfully. 
Additional info:
httpd error_log shows below : 
=============================================================
[Wed Jan 18 09:48:10.109641 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128] ipa: ERROR: non-public: TypeError: '>' not supported between instances of 'NoneType' and 'list'
[Wed Jan 18 09:48:10.109724 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128] Traceback (most recent call last):
[Wed Jan 18 09:48:10.109742 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]   File "/usr/lib/python3.6/site-packages/ipaserver/rpcserver.py", line 407, in wsgi_execute
[Wed Jan 18 09:48:10.109754 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]     result = command(*args, **options)
[Wed Jan 18 09:48:10.109767 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]   File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 471, in __call__
[Wed Jan 18 09:48:10.109779 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]     return self.__do_call(*args, **options)
[Wed Jan 18 09:48:10.109791 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]   File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 499, in __do_call
[Wed Jan 18 09:48:10.109803 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]     ret = self.run(*args, **options)
[Wed Jan 18 09:48:10.109815 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]   File "/usr/lib/python3.6/site-packages/ipalib/frontend.py", line 816, in run
[Wed Jan 18 09:48:10.109827 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]     return self.execute(*args, **options)
[Wed Jan 18 09:48:10.109840 202:3] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]   File "/usr/lib/python3.6/site-packages/ipaserver/plugins/trust.py", line 770, in execute
[Wed Jan 18 09:48:10.109852 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]     *keys, **options
[Wed Jan 18 09:48:10.109864 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]   File "/usr/lib/python3.6/site-packages/ipaserver/plugins/trust.py", line 383, in add_range
[Wed Jan 18 09:48:10.109876 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128]     max_id = int(max(max_uid, max_gid)[0])
[Wed Jan 18 09:48:10.109897 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128] TypeError: '>' not supported between instances of 'NoneType' and 'list'
[Wed Jan 18 09:48:10.109920 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128] 
[Wed Jan 18 09:48:10.110322 2023] [wsgi:error] [pid 1995:tid 140641057236736] [remote 192.168.232.103:52128] ipa: INFO: [jsonserver_session] admin@AD.TEST: trust_add/1('ad.test', trust_type='ad', realm_admin='admin.idm', realm_passwd='********', range_type='ipa-ad-trust-posix', version='2.248'): InternalError
===================================================================
As per the discussion in idm-tech, this errors indicate that the code failed to create an ID range. 
Attaching the sosreport generated with --all-logs option.

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

Issue linked to bug 2162335

Metadata Update from @frenaud:
- Issue assigned to frenaud

Metadata Update from @frenaud:
- Custom field on_review adjusted to https://github.com/freeipa/freeipa/pull/6634

Metadata Update from @frenaud:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=2162335, https://bugzilla.redhat.com/show_bug.cgi?id=2164403 (was: https://bugzilla.redhat.com/show_bug.cgi?id=2162335)

master:

  • 07975b52c31f9302b414fbad6cd885e8baad63f8 trust-add: handle missing msSFU30MaxGidNumber

ipa-4-9:

  • 703ab8c4dfb7f8fd1540c3849ad469d39695a26f trust-add: handle missing msSFU30MaxGidNumber

ipa-4-10:

  • 97fc368df2db3b559a9def236d3c3e0a12bcdd0a trust-add: handle missing msSFU30MaxGidNumber

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

Metadata