mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
schema: Fix internal error in param-{find,show} with nonexistent object
Reviewed-By: Rob Crittenden <rcritten@redhat.com> Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
parent
d87163c290
commit
7ab49dda6d
@ -626,16 +626,25 @@ class param(BaseParam):
|
||||
return obj
|
||||
|
||||
def _retrieve(self, metaobjectfull_name, name, **kwargs):
|
||||
found = False
|
||||
try:
|
||||
metaobj = self.api.Command[metaobjectfull_name]
|
||||
plugin = self.api.Object['command']
|
||||
except KeyError:
|
||||
metaobj = self.api.Object[metaobjectfull_name]
|
||||
plugin = self.api.Object['class']
|
||||
try:
|
||||
metaobj = self.api.Object[metaobjectfull_name]
|
||||
plugin = self.api.Object['class']
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
found = True
|
||||
else:
|
||||
found = True
|
||||
|
||||
for param in plugin._iter_params(metaobj):
|
||||
if param.name == name:
|
||||
return metaobj, param
|
||||
if found:
|
||||
for param in plugin._iter_params(metaobj):
|
||||
if param.name == name:
|
||||
return metaobj, param
|
||||
|
||||
raise errors.NotFound(
|
||||
reason=_("%(pkey)s: %(oname)s not found") % {
|
||||
@ -648,8 +657,11 @@ class param(BaseParam):
|
||||
metaobj = self.api.Command[metaobjectfull_name]
|
||||
plugin = self.api.Object['command']
|
||||
except KeyError:
|
||||
metaobj = self.api.Object[metaobjectfull_name]
|
||||
plugin = self.api.Object['class']
|
||||
try:
|
||||
metaobj = self.api.Object[metaobjectfull_name]
|
||||
plugin = self.api.Object['class']
|
||||
except KeyError:
|
||||
return tuple()
|
||||
|
||||
return ((metaobj, param) for param in plugin._iter_params(metaobj))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user