ac7d03
From f50331d2f9f34ae17a3d5323e74982ca87eba12e Mon Sep 17 00:00:00 2001
ac7d03
From: Florence Blanc-Renaud <flo@redhat.com>
ac7d03
Date: Thu, 20 Apr 2017 16:31:53 +0200
ac7d03
Subject: [PATCH] upgrade: adtrust update_tdo_gidnumber plugin must check if
ac7d03
 adtrust is installed
ac7d03
ac7d03
During upgrade, the plugin update_tdo_gidnumber is launched in order to
ac7d03
add a gidnumber to the Trusted Domain Object.
ac7d03
This plugin should not be run when ad trust is not installed, otherwise an
ac7d03
error message is displayed.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6881
ac7d03
ac7d03
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
ac7d03
---
ac7d03
 ipaserver/install/plugins/adtrust.py | 5 +++++
ac7d03
 1 file changed, 5 insertions(+)
ac7d03
ac7d03
diff --git a/ipaserver/install/plugins/adtrust.py b/ipaserver/install/plugins/adtrust.py
ac7d03
index 075f197780edc2aadf42fa82b71e9e2b29e66ea9..a72af00635649ddf54640738c2f28cb09c7e91bb 100644
ac7d03
--- a/ipaserver/install/plugins/adtrust.py
ac7d03
+++ b/ipaserver/install/plugins/adtrust.py
ac7d03
@@ -329,6 +329,11 @@ class update_tdo_gidnumber(Updater):
ac7d03
     def execute(self, **options):
ac7d03
         ldap = self.api.Backend.ldap2
ac7d03
 
ac7d03
+        # First, see if trusts are enabled on the server
ac7d03
+        if not self.api.Command.adtrust_is_enabled()['result']:
ac7d03
+            self.log.debug('AD Trusts are not enabled on this server')
ac7d03
+            return False, []
ac7d03
+
ac7d03
         # Read the gidnumber of the fallback group
ac7d03
         dn = DN(('cn', ADTRUSTInstance.FALLBACK_GROUP_NAME),
ac7d03
                 self.api.env.container_group,
ac7d03
-- 
ac7d03
2.12.2
ac7d03