summaryrefslogtreecommitdiffstats
path: root/ipaserver/install/plugins
diff options
context:
space:
mode:
authorStanislav Laznicka <slaznick@redhat.com>2016-10-13 15:08:31 +0200
committerJan Cholasta <jcholast@redhat.com>2016-11-11 12:13:56 +0100
commit83e72d704630b9cc5a1f713dfee30601950eb5e9 (patch)
tree9a14580ca66824d2d4c0d9bf8b211295ab82a044 /ipaserver/install/plugins
parenteac6f52957c361c219ad6048b515ddb62da31154 (diff)
downloadfreeipa-83e72d704630b9cc5a1f713dfee30601950eb5e9.tar.gz
freeipa-83e72d704630b9cc5a1f713dfee30601950eb5e9.tar.xz
freeipa-83e72d704630b9cc5a1f713dfee30601950eb5e9.zip
Move ds.replica_populate to an update plugin
Replica populate can be applied with other update plugins. https://fedorahosted.org/freeipa/ticket/6392 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaserver/install/plugins')
-rw-r--r--ipaserver/install/plugins/update_ldap_server_list.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/ipaserver/install/plugins/update_ldap_server_list.py b/ipaserver/install/plugins/update_ldap_server_list.py
new file mode 100644
index 000000000..c77a1fe45
--- /dev/null
+++ b/ipaserver/install/plugins/update_ldap_server_list.py
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
+#
+
+from ipalib import Registry
+from ipalib import Updater
+from ipalib import errors
+from ipapython.dn import DN
+
+register = Registry()
+
+
+@register()
+class update_ldap_server_list(Updater):
+ """
+ Update defaultServerList, an option that helps Solaris
+ clients discover LDAP server replicas.
+ """
+ def execute(self, **options):
+ ldap = self.api.Backend.ldap2
+
+ dn = DN(('cn', 'default'), ('ou', 'profile'), self.api.env.basedn)
+ try:
+ entry = ldap.get_entry(dn)
+ srvlist = entry.single_value.get('defaultServerList', '')
+ srvlist = srvlist.split()
+ if not self.api.env.host in srvlist:
+ srvlist.append(self.api.env.host)
+ attr = ' '.join(srvlist)
+ entry['defaultServerList'] = attr
+ ldap.update_entry(entry)
+ except errors.NotFound:
+ pass
+ except ldap.TYPE_OR_VALUE_EXISTS:
+ pass
+
+ # no restart, no updates
+ return False, ()