Hi,

the attached patch fixes <https://fedorahosted.org/freeipa/ticket/5360>.

Honza

--
Jan Cholasta
From df17fde35eda141857da72fbf2296dacabd827f4 Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jchol...@redhat.com>
Date: Mon, 12 Oct 2015 14:58:40 +0200
Subject: [PATCH] upgrade: make sure ldap2 is connected in export_kra_agent_pem

https://fedorahosted.org/freeipa/ticket/5360
---
 ipaserver/install/server/upgrade.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
index 5d3972b..32ea31b 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -1258,6 +1258,13 @@ def export_kra_agent_pem():
         root_logger.info("KRA agent PEM file already exported")
         return
 
+    if not api.Backend.ldap2.isconnected():
+        try:
+            api.Backend.ldap2.connect(autobind=True)
+        except ipalib.errors.PublicError as e:
+            root_logger.error("Cannot connect to LDAP: %s", e)
+            return
+
     if not api.Command.kra_is_enabled()['result']:
         root_logger.info("KRA is not enabled")
         return
-- 
2.4.3

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to