From 60cbb2471829504edb207c0914edd56a962593cf Mon Sep 17 00:00:00 2001
From: Jan Cholasta <jcholast@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
Reviewed-By: Ales 'alich' Marecek <amarecek@redhat.com>
---
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 51a2dd3d0e3693c12f11579a84175c7719651da9..e0a45a097171613397db42e1c035f0d818a3ecf5 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -1252,6 +1252,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