ipaserver/dcerpc: avoid logging stack trace in retrieve_anonymously

If an error occured when searching foc a DC a stack trace was logged,
and execution was aborted.

This patch allows execution to continue and log the error message that
caused the 'finddc' do fail.

Fixes: https://pagure.io/freeipa/issue/9484
Related: https://issues.redhat.com/browse/RHEL-12149

Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Rafael Guterres Jeffman 2023-11-22 15:03:37 -03:00 committed by Florence Blanc-Renaud
parent 5e17c134aa
commit 60fe752da4

View File

@ -935,7 +935,12 @@ class TrustDomainInstance:
else:
result = netrc.finddc(address=remote_host, flags=flags)
except RuntimeError as e:
raise assess_dcerpc_error(e)
dcerpc_error = assess_dcerpc_error(e)
logger.error(
getattr(dcerpc_error, "info", None)
or getattr(dcerpc_error, "reason", str(dcerpc_error))
)
return False
if not result:
return False