c58629
From 276a0dfa90be417a0ce37b15027f716baa97a453 Mon Sep 17 00:00:00 2001
c58629
From: Florence Blanc-Renaud <flo@redhat.com>
c58629
Date: Thu, 2 Nov 2017 09:34:43 +0100
c58629
Subject: [PATCH] Fix ipa-restore (python2)
c58629
c58629
In order to stop tracking LDAP server cert, ipa-restore is using
c58629
dse.ldif to find the certificate name. But when ipa-server-install
c58629
--uninstall has been called, the file does not exist, leading to a
c58629
IOError exception (regression introduced by 87540fe).
c58629
c58629
The ipa-restore code properly catches the exception in python3 because
c58629
IOError is a subclass of OSError, but in python2 this is not the case.
c58629
The fix catches IOError and OSError to work properly with both version.
c58629
c58629
Fixes:
c58629
https://pagure.io/freeipa/issue/7231
c58629
c58629
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
c58629
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
c58629
---
c58629
 ipaserver/install/ipa_restore.py | 2 +-
c58629
 1 file changed, 1 insertion(+), 1 deletion(-)
c58629
c58629
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
c58629
index 96fc493c774f5de4c8149bf477cb66ec4960de4f..923b1d6696d33c0bb07ca018b53dd3dabcc191aa 100644
c58629
--- a/ipaserver/install/ipa_restore.py
c58629
+++ b/ipaserver/install/ipa_restore.py
c58629
@@ -815,7 +815,7 @@ class Restore(admintool.AdminTool):
c58629
         try:
c58629
             dsinstance.DsInstance().stop_tracking_certificates(
c58629
                 installutils.realm_to_serverid(api.env.realm))
c58629
-        except OSError:
c58629
+        except (OSError, IOError):
c58629
             # When IPA is not installed, DS NSS DB does not exist
c58629
             pass
c58629
 
c58629
-- 
c58629
2.13.6
c58629