LGTM: raise handle_not_found()

Turn calls "handle_not_found()" into "raise handle_not_found()" to
indicate control flow chance. It makes the code easier to understand,
the control flow more obvious and helps static analyzers.

It's OK to raise here because handle_not_found() always raises an
exception.

https://pagure.io/freeipa/issue/7344

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Christian Heimes
2018-01-03 12:11:15 +01:00
parent 73ee9ff40e
commit f60b2c5906
25 changed files with 205 additions and 145 deletions

View File

@@ -349,7 +349,7 @@ class certmaprule_enable(LDAPQuery):
try:
entry_attrs = ldap.get_entry(dn, ['ipaenabledflag'])
except errors.NotFound:
self.obj.handle_not_found(cn)
raise self.obj.handle_not_found(cn)
entry_attrs['ipaenabledflag'] = ['TRUE']
@@ -378,7 +378,7 @@ class certmaprule_disable(LDAPQuery):
try:
entry_attrs = ldap.get_entry(dn, ['ipaenabledflag'])
except errors.NotFound:
self.obj.handle_not_found(cn)
raise self.obj.handle_not_found(cn)
entry_attrs['ipaenabledflag'] = ['FALSE']