summaryrefslogtreecommitdiffstats
path: root/ipaclient/install/client.py
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2017-01-03 07:43:12 +0100
committerMartin Babinsky <mbabinsk@redhat.com>2017-01-20 17:34:07 +0100
commit26630db9d0fb1d9c8a02840b71b3fb3e8bdf3e0d (patch)
treeebc8e32f9f509f0ffaea069999c84c35da37a013 /ipaclient/install/client.py
parent91c050b4e093802d8c6b510a22d6e435faba965f (diff)
downloadfreeipa-26630db9d0fb1d9c8a02840b71b3fb3e8bdf3e0d.tar.gz
freeipa-26630db9d0fb1d9c8a02840b71b3fb3e8bdf3e0d.tar.xz
freeipa-26630db9d0fb1d9c8a02840b71b3fb3e8bdf3e0d.zip
client install: correctly report all failures
In commit 5249eb817efbb5708d097173a8d5f1e322fb201e, the client install code was converted to use exception handling instead of return codes. However, some return statements were not converted to raise statements and as a result, ipa-client-install will report success in some error conditions. Convert the return statements to raise statements to fix the issue. https://fedorahosted.org/freeipa/ticket/6392 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
Diffstat (limited to 'ipaclient/install/client.py')
-rw-r--r--ipaclient/install/client.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 08576ebc6..aa3449ccb 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -2716,13 +2716,13 @@ def _install(options):
except errors.PublicError as e2:
root_logger.warning(
"Second connect with delegate=True also failed: %s", e2)
- root_logger.error(
- "Cannot connect to the IPA server RPC interface: %s", e2)
- return CLIENT_INSTALL_ERROR
+ raise ScriptError(
+ "Cannot connect to the IPA server RPC interface: %s" % e2,
+ rval=CLIENT_INSTALL_ERROR)
except errors.PublicError as e:
- root_logger.error(
- "Cannot connect to the server due to generic error: %s", e)
- return CLIENT_INSTALL_ERROR
+ raise ScriptError(
+ "Cannot connect to the server due to generic error: %s" % e,
+ rval=CLIENT_INSTALL_ERROR)
# Use the RPC directly so older servers are supported
try:
@@ -2745,8 +2745,9 @@ def _install(options):
try:
create_ipa_nssdb()
except ipautil.CalledProcessError as e:
- root_logger.error("Failed to create IPA NSS database: %s", e)
- return CLIENT_INSTALL_ERROR
+ raise ScriptError(
+ "Failed to create IPA NSS database: %s" % e,
+ rval=CLIENT_INSTALL_ERROR)
# Get CA certificates from the certificate store
try:
@@ -2769,9 +2770,9 @@ def _install(options):
try:
ipa_db.add_cert(cert, nickname, trust_flags)
except CalledProcessError as e:
- root_logger.error(
- "Failed to add %s to the IPA NSS database.", nickname)
- return CLIENT_INSTALL_ERROR
+ raise ScriptError(
+ "Failed to add %s to the IPA NSS database." % nickname,
+ rval=CLIENT_INSTALL_ERROR)
# Add the CA certificates to the platform-dependant systemwide CA store
tasks.insert_ca_certs_into_systemwide_ca_store(ca_certs)
@@ -2875,7 +2876,7 @@ def _install(options):
cli_domain, cli_server, dnsok,
options, nosssd_files[configurer.__name__])
if retcode:
- return CLIENT_INSTALL_ERROR
+ raise ScriptError(rval=CLIENT_INSTALL_ERROR)
if conf:
root_logger.info(
"%s configured using configuration file(s) %s",