httpinstance.disable_system_trust: Don't fail if module 'Root Certs' is not available

Server installation failed when attmpting to disable module 'Root Certs' and
the module was not available in HTTP_ALIAS_DIR. When the module is not
available there's no need to disable it and the error may be treated as
success.

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

Reviewed-By: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
This commit is contained in:
David Kupka authored and Tomas Krizek committed 2017-03-28 17:10:54 +02:00
1 parent e204d030fc
commit 0128e805e5
1 file changed
+11 -3
+11 -3
View File
@@ -355,9 +355,17 @@ class HTTPInstance(service.Service):
name = 'Root Certs'
args = [paths.MODUTIL, '-dbdir', paths.HTTPD_ALIAS_DIR, '-force']
result = ipautil.run(args + ['-list', name],
env={},
capture_output=True)
try:
result = ipautil.run(args + ['-list', name],
env={},
capture_output=True)
except ipautil.CalledProcessError as e:
if e.returncode == 29: # ERROR: Module not found in database.
root_logger.debug(
'Module %s not available, treating as disabled', name)
return False
raise
if 'Status: Enabled' in result.output:
ipautil.run(args + ['-disable', name], env={})
return True