mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-23 09:14:43 +00:00
ipaserver_prepare: Properly report error, do show trace back
The raises of RuntimeError, ValueError and ScriptError are currently not properly handled in ipaserver_prepare. This results in a trace back error shown in Ansible instead of only showing the error message. This happened for example if a nameserver is in /etc/resolv.conf that is not reachable.
This commit is contained in:
@@ -195,6 +195,8 @@ def main():
|
|||||||
if not options.ca_subject:
|
if not options.ca_subject:
|
||||||
options.ca_subject = str(default_ca_subject_dn(options.subject_base))
|
options.ca_subject = str(default_ca_subject_dn(options.subject_base))
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
# Configuration for ipalib, we will bootstrap and finalize later, after
|
# Configuration for ipalib, we will bootstrap and finalize later, after
|
||||||
# we are sure we have the configuration file ready.
|
# we are sure we have the configuration file ready.
|
||||||
cfg = dict(
|
cfg = dict(
|
||||||
@@ -286,6 +288,10 @@ def main():
|
|||||||
if tasks.configure_pkcs11_modules(fstore):
|
if tasks.configure_pkcs11_modules(fstore):
|
||||||
ansible_log.info("Disabled p11-kit-proxy")
|
ansible_log.info("Disabled p11-kit-proxy")
|
||||||
|
|
||||||
|
except (RuntimeError, ValueError, ScriptError,
|
||||||
|
ipautil.CalledProcessError) as e:
|
||||||
|
ansible_module.fail_json(msg=str(e))
|
||||||
|
|
||||||
ansible_module.exit_json(changed=True,
|
ansible_module.exit_json(changed=True,
|
||||||
### basic ###
|
### basic ###
|
||||||
ip_addresses=[ str(ip) for ip in ip_addresses ],
|
ip_addresses=[ str(ip) for ip in ip_addresses ],
|
||||||
|
|||||||
Reference in New Issue
Block a user