From 0128e805e591bc8ca5cea99739ad4cd7478df0b4 Mon Sep 17 00:00:00 2001 From: David Kupka Date: Mar 28 2017 15:10:54 +0000 Subject: 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 Reviewed-By: Stanislav Laznicka --- diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py index f6f0b0c..01b55e7 100644 --- a/ipaserver/install/httpinstance.py +++ b/ipaserver/install/httpinstance.py @@ -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