pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0017-ipa-restore-Don-t-crash-if-AD-trust-is-not-installed.patch

e3ffab
From d693ffd819a2016c6cc871107d5f66353c999888 Mon Sep 17 00:00:00 2001
e3ffab
From: Petr Viktorin <pviktori@redhat.com>
e3ffab
Date: Mon, 10 Nov 2014 13:29:58 +0100
e3ffab
Subject: [PATCH] ipa-restore: Don't crash if AD trust is not installed
e3ffab
e3ffab
https://fedorahosted.org/freeipa/ticket/4668
e3ffab
e3ffab
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
e3ffab
---
e3ffab
 ipaserver/install/ipa_restore.py | 13 +++++++++++--
e3ffab
 1 file changed, 11 insertions(+), 2 deletions(-)
e3ffab
e3ffab
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py
e3ffab
index 239de99c462639854e8e25c6b9278cb94b6fc6b8..352a1ca2bf283c0beb8c95925c6eb9c9984b3338 100644
e3ffab
--- a/ipaserver/install/ipa_restore.py
e3ffab
+++ b/ipaserver/install/ipa_restore.py
e3ffab
@@ -37,7 +37,6 @@ from ipaserver.install.replication import (wait_for_task, ReplicationManager,
e3ffab
                                            get_cs_replication_manager)
e3ffab
 from ipaserver.install import installutils
e3ffab
 from ipaserver.install import httpinstance
e3ffab
-from ipaserver.install import adtrustinstance
e3ffab
 from ipapython import ipaldap
e3ffab
 import ipapython.errors
e3ffab
 from ipaplatform.tasks import tasks
e3ffab
@@ -45,6 +44,11 @@ from ipaserver.install.ipa_backup import BACKUP_DIR
e3ffab
 from ipaplatform import services
e3ffab
 from ipaplatform.paths import paths
e3ffab
 
e3ffab
+try:
e3ffab
+    from ipaserver.install import adtrustinstance
e3ffab
+except ImportError:
e3ffab
+    adtrustinstance = None
e3ffab
+
e3ffab
 
e3ffab
 def recursive_chown(path, uid, gid):
e3ffab
     '''
e3ffab
@@ -646,7 +650,12 @@ class Restore(admintool.AdminTool):
e3ffab
     def restore_selinux_booleans(self):
e3ffab
         bools = dict(httpinstance.SELINUX_BOOLEAN_SETTINGS)
e3ffab
         if 'ADTRUST' in self.backup_services:
e3ffab
-            bools.update(adtrustinstance.SELINUX_BOOLEAN_SETTINGS)
e3ffab
+            if adtrustinstance:
e3ffab
+                bools.update(adtrustinstance.SELINUX_BOOLEAN_SETTINGS)
e3ffab
+            else:
e3ffab
+                self.log.error(
e3ffab
+                    'The AD trust package was not found, '
e3ffab
+                    'not setting SELinux booleans.')
e3ffab
         try:
e3ffab
             tasks.set_selinux_booleans(bools)
e3ffab
         except ipapython.errors.SetseboolError as e:
e3ffab
-- 
e3ffab
2.1.0
e3ffab