diff options
author | Mark McLoughlin <markmc@redhat.com> | 2008-01-11 10:36:25 +0000 |
---|---|---|
committer | Mark McLoughlin <markmc@redhat.com> | 2008-01-11 10:36:25 +0000 |
commit | ae099fe006f7759e3cdf55690911adf1cf31bf6b (patch) | |
tree | 259ff16c57a323c72921202f05b0db7e84aa450c | |
parent | ff6c720026045576598ff7d955f3ccb2bf0aadac (diff) | |
download | freeipa-ae099fe006f7759e3cdf55690911adf1cf31bf6b.tar.gz freeipa-ae099fe006f7759e3cdf55690911adf1cf31bf6b.tar.xz freeipa-ae099fe006f7759e3cdf55690911adf1cf31bf6b.zip |
Refactor some krbinstance templating code
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
-rw-r--r-- | ipa-server/ipaserver/krbinstance.py | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/ipa-server/ipaserver/krbinstance.py b/ipa-server/ipaserver/krbinstance.py index 358e47cc2..db7004e4c 100644 --- a/ipa-server/ipaserver/krbinstance.py +++ b/ipa-server/ipaserver/krbinstance.py @@ -262,32 +262,19 @@ class KrbInstance(service.Service): def __create_replica_instance(self): self.__create_instance(replica=True) + def __template_file(self, path): + template = os.path.join(ipautil.SHARE_DIR, os.path.basename(path) + ".template") + conf = ipautil.template_file(template, self.sub_dict) + fd = open(path, "w+") + fd.write(conf) + fd.close() + def __create_instance(self, replica=False): - kdc_conf = ipautil.template_file(ipautil.SHARE_DIR+"kdc.conf.template", self.sub_dict) - kdc_fd = open("/var/kerberos/krb5kdc/kdc.conf", "w+") - kdc_fd.write(kdc_conf) - kdc_fd.close() - - krb5_conf = ipautil.template_file(ipautil.SHARE_DIR+"krb5.conf.template", self.sub_dict) - krb5_fd = open("/etc/krb5.conf", "w+") - krb5_fd.write(krb5_conf) - krb5_fd.close() - - # Windows configuration files - krb5_ini = ipautil.template_file(ipautil.SHARE_DIR+"krb5.ini.template", self.sub_dict) - krb5_fd = open("/usr/share/ipa/html/krb5.ini", "w+") - krb5_fd.write(krb5_ini) - krb5_fd.close() - - krb_con = ipautil.template_file(ipautil.SHARE_DIR+"krb.con.template", self.sub_dict) - krb_fd = open("/usr/share/ipa/html/krb.con", "w+") - krb_fd.write(krb_con) - krb_fd.close() - - krb_realm = ipautil.template_file(ipautil.SHARE_DIR+"krbrealm.con.template", self.sub_dict) - krb_fd = open("/usr/share/ipa/html/krbrealm.con", "w+") - krb_fd.write(krb_realm) - krb_fd.close() + self.__template_file("/var/kerberos/krb5kdc/kdc.conf") + self.__template_file("/etc/krb5.conf") + self.__template_file("/usr/share/ipa/html/krb5.ini") + self.__template_file("/usr/share/ipa/html/krb.con") + self.__template_file("/usr/share/ipa/html/krbrealm.con") if not replica: #populate the directory with the realm structure |