summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2018-05-22 10:58:51 +0200
committerRob Crittenden <rcritten@redhat.com>2018-06-05 16:34:27 -0400
commit992a5f482319369c231456e311bb316dd7747016 (patch)
treeb1fce0acbf6d1ed06a0f53ef8a5774aba18fed39
parent326fd6a70dc9fc9cb4b8bc45f76fe3f6092ee2a2 (diff)
downloadfreeipa-992a5f482319369c231456e311bb316dd7747016.tar.gz
freeipa-992a5f482319369c231456e311bb316dd7747016.tar.xz
freeipa-992a5f482319369c231456e311bb316dd7747016.zip
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>
-rw-r--r--client/Makefile.am1
-rw-r--r--client/share/Makefile.am6
-rw-r--r--client/share/freeipa.template (renamed from install/share/freeipa.template)0
-rw-r--r--configure.ac1
-rwxr-xr-xfreeipa.spec.in3
-rw-r--r--install/share/Makefile.am1
-rw-r--r--ipaclient/install/client.py2
-rw-r--r--ipaplatform/base/paths.py1
-rw-r--r--ipaserver/install/krbinstance.py21
9 files changed, 24 insertions, 12 deletions
diff --git a/client/Makefile.am b/client/Makefile.am
index e83106123..6d3d6c4ba 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -90,6 +90,7 @@ ipa_join_LDADD = \
$(NULL)
SUBDIRS = \
+ share \
man \
$(NULL)
diff --git a/client/share/Makefile.am b/client/share/Makefile.am
new file mode 100644
index 000000000..6d4a62d5e
--- /dev/null
+++ b/client/share/Makefile.am
@@ -0,0 +1,6 @@
+NULL =
+
+appdir = $(IPA_DATA_DIR)/client
+dist_app_DATA = \
+ freeipa.template \
+ $(NULL)
diff --git a/install/share/freeipa.template b/client/share/freeipa.template
index aced0a928..aced0a928 100644
--- a/install/share/freeipa.template
+++ b/client/share/freeipa.template
diff --git a/configure.ac b/configure.ac
index 50371434a..b8f635f8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/freeipa.spec.in b/freeipa.spec.in
index 10b7e9810..c7363f83f 100755
--- a/freeipa.spec.in
+++ b/freeipa.spec.in
@@ -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
diff --git a/install/share/Makefile.am b/install/share/Makefile.am
index fefcd1e66..536f68194 100644
--- a/install/share/Makefile.am
+++ b/install/share/Makefile.am
@@ -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 \
diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 63e14306b..3a89dbbed 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -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)
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index b65b7d076..bc04964b4 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -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"
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index df6344998..6ba05b286 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -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)