Blob Blame History Raw
From ce55779854e90bb03230dc010092dddf1e9fde67 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jcholast@redhat.com>
Date: Mon, 12 Jan 2015 17:03:22 +0000
Subject: [PATCH] Fix ipa-restore on systems without IPA installed

https://fedorahosted.org/freeipa/ticket/4824

Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
---
 ipaserver/install/ipa_restore.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
index 3b4cf6a7c05245076abde7a9c13e53bc9636b69a..f3a60fcc7a60c38c0d2ae1e52fc4fe7712411ec1 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -692,8 +692,12 @@ class Restore(admintool.AdminTool):
         cainstance.stop_tracking_certificates(
             dogtag.configured_constants())
         httpinstance.HTTPInstance().stop_tracking_certificates()
-        dsinstance.DsInstance().stop_tracking_certificates(
-            realm_to_serverid(api.env.realm))
+        try:
+            dsinstance.DsInstance().stop_tracking_certificates(
+                realm_to_serverid(api.env.realm))
+        except OSError:
+            # When IPA is not installed, DS NSS DB does not exist
+            pass
 
         for basename in ('cert8.db', 'key3.db', 'secmod.db', 'pwdfile.txt'):
             filename = os.path.join(paths.IPA_NSSDB_DIR, basename)
-- 
2.1.0