summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-10-17 13:24:49 +0200
committerMartin Kosek <mkosek@redhat.com>2014-10-17 14:09:10 +0200
commit5c9aec36050e790a503ecd6e2c50aead0efa511b (patch)
tree7c709133ebdfbbb8e503dead2a5f43d280b0df5c
parent889bf4ac7a0e06adebaaacb211d9b84e11129ac3 (diff)
downloadfreeipa-5c9aec36050e790a503ecd6e2c50aead0efa511b.tar.gz
freeipa-5c9aec36050e790a503ecd6e2c50aead0efa511b.tar.xz
freeipa-5c9aec36050e790a503ecd6e2c50aead0efa511b.zip
dns: fix privileges' memberof during dns install
Permissions with member attrs pointing to privileges are created before the privileges. Run memberof plugin task to fix other ends of the relationships. https://fedorahosted.org/freeipa/ticket/4637 Reviewed-By: Martin Kosek <mkosek@redhat.com>
-rw-r--r--ipaserver/install/bindinstance.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 9a27c7817..ecaf4e0f9 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -22,6 +22,7 @@ import os
import pwd
import netaddr
import re
+import time
import ldap
@@ -628,6 +629,35 @@ class BindInstance(service.Service):
def __setup_dns_container(self):
self._ldap_mod("dns.ldif", self.sub_dict)
+ self.__fix_dns_privilege_members()
+
+ def __fix_dns_privilege_members(self):
+ ldap = api.Backend.ldap2
+
+ cn = 'Update PBAC memberOf %s' % time.time()
+ task_dn = DN(('cn', cn), ('cn', 'memberof task'), ('cn', 'tasks'),
+ ('cn', 'config'))
+ basedn = DN(api.env.container_privilege, api.env.basedn)
+ entry = ldap.make_entry(
+ task_dn,
+ objectclass=['top', 'extensibleObject'],
+ cn=[cn],
+ basedn=[basedn],
+ filter=['(objectclass=*)'],
+ ttl=[10])
+ ldap.add_entry(entry)
+
+ start_time = time.time()
+ while True:
+ try:
+ task = ldap.get_entry(task_dn)
+ except errors.NotFound:
+ break
+ if 'nstaskexitcode' in task:
+ break
+ time.sleep(1)
+ if time.time() > (start_time + 60):
+ raise errors.TaskTimeout(task='memberof', task_dn=task_dn)
def __setup_zone(self):
nameserver_ip_address = self.ip_address