Skip to content
Snippets Groups Projects
Commit 059eae47 authored by Thomas Woerner's avatar Thomas Woerner
Browse files

ipaclient_test: Added error message to ScriptError calls only using rval

The use of ScriptError without an error message but with rval resulted in
very limited information in ansible. The error messages from logger.error
calls have have added to these ScriptError raises.
parent 3251d0ac
Branches
Tags
No related merge requests found
...@@ -477,7 +477,9 @@ def main(): ...@@ -477,7 +477,9 @@ def main():
# logger.info( # logger.info(
# "If you want to reinstall the IPA client, uninstall it first " # "If you want to reinstall the IPA client, uninstall it first "
# "using 'ipa-client-install --uninstall'.") # "using 'ipa-client-install --uninstall'.")
# raise ScriptError(rval=CLIENT_ALREADY_CONFIGURED) # raise ScriptError(
# "IPA client is already configured on this system.",
# rval=CLIENT_ALREADY_CONFIGURED)
check_ldap_conf() check_ldap_conf()
...@@ -583,8 +585,9 @@ def main(): ...@@ -583,8 +585,9 @@ def main():
logger.warning("Using existing certificate '%s'.", paths.IPA_CA_CRT) logger.warning("Using existing certificate '%s'.", paths.IPA_CA_CRT)
if not check_ip_addresses(options): if not check_ip_addresses(options):
module.warn("Failed to check ip addresses, check installation log") raise ScriptError(
raise ScriptError(rval=CLIENT_INSTALL_ERROR) "Failed to check ip addresses, check installation log",
rval=CLIENT_INSTALL_ERROR)
# Create the discovery instance # Create the discovery instance
ds = ipadiscovery.IPADiscovery() ds = ipadiscovery.IPADiscovery()
...@@ -608,15 +611,16 @@ def main(): ...@@ -608,15 +611,16 @@ def main():
"This may mean that the remote server is not up " "This may mean that the remote server is not up "
"or is not reachable due to network or firewall settings.") "or is not reachable due to network or firewall settings.")
print_port_conf_info() print_port_conf_info()
module.warn("Failed to verify that %s is an IPA Server." % raise ScriptError("Failed to verify that %s is an IPA Server." %
', '.join(options.server)) ', '.join(options.server),
raise ScriptError(rval=CLIENT_INSTALL_ERROR) rval=CLIENT_INSTALL_ERROR)
if ret == ipadiscovery.BAD_HOST_CONFIG: if ret == ipadiscovery.BAD_HOST_CONFIG:
logger.error("Can't get the fully qualified name of this host") logger.error("Can't get the fully qualified name of this host")
logger.info("Check that the client is properly configured") logger.info("Check that the client is properly configured")
module.warn("Can't get the fully qualified name of this host") raise ScriptError(
raise ScriptError(rval=CLIENT_INSTALL_ERROR) "Can't get the fully qualified name of this host",
rval=CLIENT_INSTALL_ERROR)
if ret == ipadiscovery.NOT_FQDN: if ret == ipadiscovery.NOT_FQDN:
raise ScriptError( raise ScriptError(
"{} is not a fully-qualified hostname".format(hostname), "{} is not a fully-qualified hostname".format(hostname),
...@@ -723,7 +727,8 @@ def main(): ...@@ -723,7 +727,8 @@ def main():
logger.error("%s is not an IPA v2 Server.", cli_server[0]) logger.error("%s is not an IPA v2 Server.", cli_server[0])
print_port_conf_info() print_port_conf_info()
logger.debug("(%s: %s)", cli_server[0], cli_server_source) logger.debug("(%s: %s)", cli_server[0], cli_server_source)
raise ScriptError(rval=CLIENT_INSTALL_ERROR) raise ScriptError("%s is not an IPA v2 Server." % cli_server[0],
rval=CLIENT_INSTALL_ERROR)
if ret == ipadiscovery.NO_ACCESS_TO_LDAP: if ret == ipadiscovery.NO_ACCESS_TO_LDAP:
logger.warning("Anonymous access to the LDAP server is disabled.") logger.warning("Anonymous access to the LDAP server is disabled.")
...@@ -748,7 +753,9 @@ def main(): ...@@ -748,7 +753,9 @@ def main():
"or is not reachable due to network or firewall settings.") "or is not reachable due to network or firewall settings.")
print_port_conf_info() print_port_conf_info()
logger.debug("(%s: %s)", cli_server[0], cli_server_source) logger.debug("(%s: %s)", cli_server[0], cli_server_source)
raise ScriptError(rval=CLIENT_INSTALL_ERROR) raise ScriptError("Failed to verify that %s is an IPA Server." %
cli_server[0],
rval=CLIENT_INSTALL_ERROR)
cli_kdc = ds.kdc cli_kdc = ds.kdc
if dnsok and not cli_kdc: if dnsok and not cli_kdc:
...@@ -788,7 +795,9 @@ def main(): ...@@ -788,7 +795,9 @@ def main():
"The provided realm name [%s] does not match discovered one [%s]", "The provided realm name [%s] does not match discovered one [%s]",
options.realm_name, cli_realm) options.realm_name, cli_realm)
logger.debug("(%s: %s)", cli_realm, cli_realm_source) logger.debug("(%s: %s)", cli_realm, cli_realm_source)
raise ScriptError(rval=CLIENT_INSTALL_ERROR) raise ScriptError(
"The provided realm name [%s] does not match discovered one [%s]" % (options.realm_name, cli_realm),
rval=CLIENT_INSTALL_ERROR)
cli_basedn = ds.basedn cli_basedn = ds.basedn
cli_basedn_source = ds.basedn_source cli_basedn_source = ds.basedn_source
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment