mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
User plugin: improve error related to non existing idp
The user and stageuser commands return the following error when the user is created/updated with a non existing idp: $ ipa user-add testuser --first test --last user --idp dummy ipa: ERROR: no such entry The error is not descriptive enough and has been modified to display instead: $ ipa user-add testuser --first test --last user --idp dummy ipa: ERROR: External IdP configuration dummy not found Fixes: https://pagure.io/freeipa/issue/9416 Signed-off-by: Florence Blanc-Renaud <flo@redhat.com> Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
parent
d2ed490ff4
commit
f57a7dbf50
@ -755,7 +755,11 @@ class baseuser_mod(LDAPUpdate):
|
||||
if 'ipaidpuser' not in obj_classes:
|
||||
entry_attrs['objectclass'].append('ipaidpuser')
|
||||
|
||||
answer = self.api.Object['idp'].get_dn_if_exists(cl)
|
||||
try:
|
||||
answer = self.api.Object['idp'].get_dn_if_exists(cl)
|
||||
except errors.NotFound:
|
||||
reason = "External IdP configuration {} not found"
|
||||
raise errors.NotFound(reason=_(reason).format(cl))
|
||||
entry_attrs['ipaidpconfiglink'] = answer
|
||||
|
||||
# Note: we could have used the method add_missing_object_class
|
||||
|
@ -406,7 +406,11 @@ class stageuser_add(baseuser_add):
|
||||
if 'ipaidpuser' not in entry_attrs['objectclass']:
|
||||
entry_attrs['objectclass'].append('ipaidpuser')
|
||||
|
||||
answer = self.api.Object['idp'].get_dn_if_exists(cl)
|
||||
try:
|
||||
answer = self.api.Object['idp'].get_dn_if_exists(cl)
|
||||
except errors.NotFound:
|
||||
reason = "External IdP configuration {} not found"
|
||||
raise errors.NotFound(reason=_(reason).format(cl))
|
||||
entry_attrs['ipaidpconfiglink'] = answer
|
||||
|
||||
self.pre_common_callback(ldap, dn, entry_attrs, attrs_list, *keys,
|
||||
|
@ -649,7 +649,11 @@ class user_add(baseuser_add):
|
||||
if 'ipaidpuser' not in entry_attrs['objectclass']:
|
||||
entry_attrs['objectclass'].append('ipaidpuser')
|
||||
|
||||
answer = self.api.Object['idp'].get_dn_if_exists(rcl)
|
||||
try:
|
||||
answer = self.api.Object['idp'].get_dn_if_exists(rcl)
|
||||
except errors.NotFound:
|
||||
reason = "External IdP configuration {} not found"
|
||||
raise errors.NotFound(reason=_(reason).format(rcl))
|
||||
entry_attrs['ipaidpconfiglink'] = answer
|
||||
|
||||
self.pre_common_callback(ldap, dn, entry_attrs, attrs_list, *keys,
|
||||
|
Loading…
Reference in New Issue
Block a user