Move client templates to separate directory

PR https://github.com/freeipa/freeipa/pull/1747 added the first template
for FreeIPA client package. The template file was added to server
templates, which broke client-only builds.

The template is now part of a new subdirectory for client package shared
data.

Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Christian Heimes 2018-05-22 10:58:51 +02:00 committed by Rob Crittenden
parent 326fd6a70d
commit 992a5f4823
9 changed files with 24 additions and 12 deletions

View File

@ -90,6 +90,7 @@ ipa_join_LDADD = \
$(NULL)
SUBDIRS = \
share \
man \
$(NULL)

6
client/share/Makefile.am Normal file
View File

@ -0,0 +1,6 @@
NULL =
appdir = $(IPA_DATA_DIR)/client
dist_app_DATA = \
freeipa.template \
$(NULL)

View File

@ -504,6 +504,7 @@ AC_CONFIG_FILES([
asn1/Makefile
asn1/asn1c/Makefile
client/Makefile
client/share/Makefile
client/man/Makefile
contrib/completion/Makefile
contrib/Makefile

View File

@ -1619,7 +1619,8 @@ fi
%dir %{_localstatedir}/lib/ipa-client/pki
%dir %{_localstatedir}/lib/ipa-client/sysrestore
%{_mandir}/man5/default.conf.5*
%{_usr}/share/ipa/freeipa.template
%dir %{_usr}/share/ipa/client
%{_usr}/share/ipa/client/*.template
%files python-compat

View File

@ -51,7 +51,6 @@ dist_app_DATA = \
kdc_req.conf.template \
krb5.conf.template \
krb5.ini.template \
freeipa.template \
krb.con.template \
krbrealm.con.template \
smb.conf.template \

View File

@ -668,7 +668,7 @@ def configure_krb5_conf(
# First, write a snippet to krb5.conf.d. Currently this doesn't support
# templating, but that could be changed in the future.
template = os.path.join(
paths.USR_SHARE_IPA_DIR,
paths.USR_SHARE_IPA_CLIENT_DIR,
os.path.basename(paths.KRB5_FREEIPA) + ".template"
)
shutil.copy(template, paths.KRB5_FREEIPA)

View File

@ -245,6 +245,7 @@ class BasePathNamespace(object):
USERADD = "/usr/sbin/useradd"
FONTS_DIR = "/usr/share/fonts"
USR_SHARE_IPA_DIR = "/usr/share/ipa/"
USR_SHARE_IPA_CLIENT_DIR = "/usr/share/ipa/client"
CA_TOPOLOGY_ULDIF = "/usr/share/ipa/ca-topology.uldif"
IPA_HTML_DIR = "/usr/share/ipa/html"
CA_CRT = "/usr/share/ipa/html/ca.crt"

View File

@ -310,16 +310,19 @@ class KrbInstance(service.Service):
def __add_default_acis(self):
self._ldap_mod("default-aci.ldif", self.sub_dict)
def __template_file(self, path, chmod=0o644):
template = os.path.join(paths.USR_SHARE_IPA_DIR,
os.path.basename(path) + ".template")
def __template_file(self, path, chmod=0o644, client_template=False):
if client_template:
sharedir = paths.USR_SHARE_IPA_CLIENT_DIR
else:
sharedir = paths.USR_SHARE_IPA_DIR
template = os.path.join(
sharedir, os.path.basename(path) + ".template")
conf = ipautil.template_file(template, self.sub_dict)
self.fstore.backup_file(path)
fd = open(path, "w+")
fd.write(conf)
fd.close()
if chmod is not None:
os.chmod(path, chmod)
with open(path, 'w') as f:
if chmod is not None:
os.fchmod(f.fileno(), chmod)
f.write(conf)
def __init_ipa_kdb(self):
# kdb5_util may take a very long time when entropy is low
@ -344,7 +347,7 @@ class KrbInstance(service.Service):
def __configure_instance(self):
self.__template_file(paths.KRB5KDC_KDC_CONF, chmod=None)
self.__template_file(paths.KRB5_CONF)
self.__template_file(paths.KRB5_FREEIPA)
self.__template_file(paths.KRB5_FREEIPA, client_template=True)
self.__template_file(paths.HTML_KRB5_INI)
self.__template_file(paths.KRB_CON)
self.__template_file(paths.HTML_KRBREALM_CON)