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