URL: https://github.com/freeipa/freeipa/pull/655
Author: dkupka
 Title: #655: httpinstance.disable_system_trust: Don't fail if module 'Root 
Certs' …
Action: opened

PR body:
"""
…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
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/655/head:pr655
git checkout pr655
From a06efec632a13a0ee2d05baff50790b597aa201a Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Mon, 27 Mar 2017 09:30:53 +0200
Subject: [PATCH] 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
---
 ipaserver/install/httpinstance.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index f6f0b0c..22efd2d 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -355,9 +355,15 @@ def disable_system_trust(self):
         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:
+            root_logger.debug(
+                'Module {} not available, treating as disabled'.format(name))
+            return False
+
         if 'Status: Enabled' in result.output:
             ipautil.run(args + ['-disable', name], env={})
             return True
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to