|
|
590d18 |
From 0df0907537d53f731e5ffc833a7c8d2e2d1a51f7 Mon Sep 17 00:00:00 2001
|
|
|
590d18 |
From: Martin Basti <mbasti@redhat.com>
|
|
|
590d18 |
Date: Mon, 10 Aug 2015 10:53:28 +0200
|
|
|
590d18 |
Subject: [PATCH] Fix upgrade of sidgen and extdom plugins
|
|
|
590d18 |
|
|
|
590d18 |
If configuration entries already exist, upgrade will not add them
|
|
|
590d18 |
again.
|
|
|
590d18 |
|
|
|
590d18 |
https://fedorahosted.org/freeipa/ticket/5151
|
|
|
590d18 |
|
|
|
590d18 |
Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
|
|
|
590d18 |
---
|
|
|
590d18 |
ipaserver/install/dsinstance.py | 28 +++++++++++++++++++++++++---
|
|
|
590d18 |
ipaserver/install/server/upgrade.py | 9 ++++++---
|
|
|
590d18 |
2 files changed, 31 insertions(+), 6 deletions(-)
|
|
|
590d18 |
|
|
|
590d18 |
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
|
|
|
590d18 |
index b2558024f0b345700bc544757e0eecd8b1052a1d..f33a9e03a4148dde69fc61441c878f5126f8e455 100644
|
|
|
590d18 |
--- a/ipaserver/install/dsinstance.py
|
|
|
590d18 |
+++ b/ipaserver/install/dsinstance.py
|
|
|
590d18 |
@@ -925,20 +925,42 @@ class DsInstance(service.Service):
|
|
|
590d18 |
def __add_range_check_plugin(self):
|
|
|
590d18 |
self._ldap_mod("range-check-conf.ldif", self.sub_dict)
|
|
|
590d18 |
|
|
|
590d18 |
- # These two methods are not local, they are also called from the upgrade code
|
|
|
590d18 |
def _add_sidgen_plugin(self):
|
|
|
590d18 |
"""
|
|
|
590d18 |
Add sidgen directory server plugin configuration if it does not already exist.
|
|
|
590d18 |
"""
|
|
|
590d18 |
self._ldap_mod('ipa-sidgen-conf.ldif', self.sub_dict)
|
|
|
590d18 |
|
|
|
590d18 |
+ def add_sidgen_plugin(self):
|
|
|
590d18 |
+ """
|
|
|
590d18 |
+ Add sidgen plugin configuration only if it does not already exist.
|
|
|
590d18 |
+ """
|
|
|
590d18 |
+ dn = DN('cn=IPA SIDGEN,cn=plugins,cn=config')
|
|
|
590d18 |
+ try:
|
|
|
590d18 |
+ self.admin_conn.get_entry(dn)
|
|
|
590d18 |
+ except errors.NotFound:
|
|
|
590d18 |
+ self._add_sidgen_plugin()
|
|
|
590d18 |
+ else:
|
|
|
590d18 |
+ root_logger.debug("sidgen plugin is already configured")
|
|
|
590d18 |
+
|
|
|
590d18 |
def _add_extdom_plugin(self):
|
|
|
590d18 |
"""
|
|
|
590d18 |
- Add directory server configuration for the extdom extended operation
|
|
|
590d18 |
- if it does not already exist.
|
|
|
590d18 |
+ Add directory server configuration for the extdom extended operation.
|
|
|
590d18 |
"""
|
|
|
590d18 |
self._ldap_mod('ipa-extdom-extop-conf.ldif', self.sub_dict)
|
|
|
590d18 |
|
|
|
590d18 |
+ def add_extdom_plugin(self):
|
|
|
590d18 |
+ """
|
|
|
590d18 |
+ Add extdom configuration if it does not already exist.
|
|
|
590d18 |
+ """
|
|
|
590d18 |
+ dn = DN('cn=ipa_extdom_extop,cn=plugins,cn=config')
|
|
|
590d18 |
+ try:
|
|
|
590d18 |
+ self.admin_conn.get_entry(dn)
|
|
|
590d18 |
+ except errors.NotFound:
|
|
|
590d18 |
+ self._add_extdom_plugin()
|
|
|
590d18 |
+ else:
|
|
|
590d18 |
+ root_logger.debug("extdom plugin is already configured")
|
|
|
590d18 |
+
|
|
|
590d18 |
def replica_populate(self):
|
|
|
590d18 |
self.ldap_connect()
|
|
|
590d18 |
|
|
|
590d18 |
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
|
|
|
590d18 |
index f295655dc2aa592e0215f15017c9b65af49eef80..037127918cb4c205c5049446989bfdaa674967a4 100644
|
|
|
590d18 |
--- a/ipaserver/install/server/upgrade.py
|
|
|
590d18 |
+++ b/ipaserver/install/server/upgrade.py
|
|
|
590d18 |
@@ -1261,11 +1261,11 @@ def ds_enable_sidgen_extdom_plugins(ds):
|
|
|
590d18 |
root_logger.info('[Enable sidgen and extdom plugins by default]')
|
|
|
590d18 |
|
|
|
590d18 |
if sysupgrade.get_upgrade_state('ds', 'enable_ds_sidgen_extdom_plugins'):
|
|
|
590d18 |
- root_logger.info('sidgen and extdom plugins are enabled already')
|
|
|
590d18 |
+ root_logger.debug('sidgen and extdom plugins are enabled already')
|
|
|
590d18 |
return
|
|
|
590d18 |
|
|
|
590d18 |
- ds._add_sidgen_plugin()
|
|
|
590d18 |
- ds._add_extdom_plugin()
|
|
|
590d18 |
+ ds.add_sidgen_plugin()
|
|
|
590d18 |
+ ds.add_extdom_plugin()
|
|
|
590d18 |
sysupgrade.set_upgrade_state('ds', 'enable_ds_sidgen_extdom_plugins', True)
|
|
|
590d18 |
|
|
|
590d18 |
def ca_upgrade_schema(ca):
|
|
|
590d18 |
@@ -1415,7 +1415,10 @@ def upgrade_configuration():
|
|
|
590d18 |
ds.fqdn = fqdn
|
|
|
590d18 |
ds.realm = api.env.realm
|
|
|
590d18 |
ds.suffix = ipautil.realm_to_suffix(api.env.realm)
|
|
|
590d18 |
+
|
|
|
590d18 |
+ ds.ldap_connect()
|
|
|
590d18 |
ds_enable_sidgen_extdom_plugins(ds)
|
|
|
590d18 |
+ ds.ldap_disconnect()
|
|
|
590d18 |
|
|
|
590d18 |
# Now 389-ds is available, run the remaining http tasks
|
|
|
590d18 |
if not http.is_kdcproxy_configured():
|
|
|
590d18 |
--
|
|
|
590d18 |
2.4.3
|
|
|
590d18 |
|