From d7ad62cd7e1d861270e8fd0ff8a2dd7ddba90127 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Thu, 28 Feb 2008 13:35:10 -0500 Subject: Make sure all entries are generated by us according to IPA default tree. This patch make sure that the DS setup script does not add unwanted entries. --- ipa-server/ipaserver/dsinstance.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'ipa-server/ipaserver/dsinstance.py') diff --git a/ipa-server/ipaserver/dsinstance.py b/ipa-server/ipaserver/dsinstance.py index 99ebae50..4ed4ddf0 100644 --- a/ipa-server/ipaserver/dsinstance.py +++ b/ipa-server/ipaserver/dsinstance.py @@ -97,6 +97,16 @@ ServerIdentifier= $SERVERID Suffix= $SUFFIX RootDN= cn=Directory Manager RootDNPwd= $PASSWORD +InstallLdifFile= /var/lib/dirsrv/boot.ldif +""" + +BASE_TEMPLATE = """ +dn: $SUFFIX +objectClass: top +objectClass: domain +objectClass: pilotObject +dc: $BASEDC +info: IPA V1.0 """ class DsInstance(service.Service): @@ -177,6 +187,15 @@ class DsInstance(service.Service): def __create_instance(self): self.backup_state("running", self.is_running()) self.backup_state("serverid", self.serverid) + + self.sub_dict['BASEDC'] = self.domain[:self.domain.find('.')] + base_txt = ipautil.template_str(BASE_TEMPLATE, self.sub_dict) + logging.debug(base_txt) + base_fd = file("/var/lib/dirsrv/boot.ldif", "w") + base_fd.write(base_txt) + base_fd.flush() + base_fd.close() + inf_txt = ipautil.template_str(INF_TEMPLATE, self.sub_dict) logging.debug("writing inf template") inf_fd = ipautil.write_tmp_file(inf_txt) @@ -200,6 +219,8 @@ class DsInstance(service.Service): except ipautil.CalledProcessError, e: print "failed to restart ds instance", e logging.debug("failed to restart ds instance %s" % e) + inf_fd.close() + os.remove("/var/lib/dirsrv/boot.ldif") def __add_default_schemas(self): shutil.copyfile(ipautil.SHARE_DIR + "60kerberos.ldif", -- cgit