summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2016-11-22 16:06:45 +0100
committerMartin Basti <mbasti@redhat.com>2016-11-29 14:50:51 +0100
commitd6b755e3fcaf32158f4ee36d45e3344b4a03fbc2 (patch)
treee14721c8fee437c408319276568954cf81310600
parentf919ab4ee0ec26d77ee6978e75de5daba4073402 (diff)
downloadfreeipa-d6b755e3fcaf32158f4ee36d45e3344b4a03fbc2.tar.gz
freeipa-d6b755e3fcaf32158f4ee36d45e3344b4a03fbc2.tar.xz
freeipa-d6b755e3fcaf32158f4ee36d45e3344b4a03fbc2.zip
ipautil: remove SHARE_DIR and PLUGIN_SHARE_DIR
SHARE_DIR and PLUGIN_SHARE_DIR depend on ipaplatform. Replace all uses of SHARE_DIR with paths.USR_SHARE_IPA_DIR and remove both SHARE_DIR and PLUGIN_SHARE_DIR. https://fedorahosted.org/freeipa/ticket/6474 Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
-rwxr-xr-xinstall/share/copy-schema-to-ca.py3
-rw-r--r--ipaplatform/base/paths.py1
-rw-r--r--ipaplatform/redhat/tasks.py2
-rw-r--r--ipapython/ipautil.py3
-rw-r--r--ipaserver/advise/plugins/legacy_clients.py11
-rw-r--r--ipaserver/dcerpc.py5
-rw-r--r--ipaserver/install/adtrustinstance.py2
-rw-r--r--ipaserver/install/bindinstance.py4
-rw-r--r--ipaserver/install/cainstance.py2
-rw-r--r--ipaserver/install/custodiainstance.py2
-rw-r--r--ipaserver/install/dogtaginstance.py3
-rw-r--r--ipaserver/install/dsinstance.py13
-rw-r--r--ipaserver/install/httpinstance.py11
-rw-r--r--ipaserver/install/krbinstance.py3
-rw-r--r--ipaserver/install/opendnssecinstance.py6
-rw-r--r--ipaserver/install/server/upgrade.py15
-rw-r--r--ipaserver/install/service.py2
17 files changed, 53 insertions, 35 deletions
diff --git a/install/share/copy-schema-to-ca.py b/install/share/copy-schema-to-ca.py
index 9edc0cd08..658204bc1 100755
--- a/install/share/copy-schema-to-ca.py
+++ b/install/share/copy-schema-to-ca.py
@@ -17,6 +17,7 @@ import shutil
from hashlib import sha1
+from ipaplatform.paths import paths
from ipapython import ipautil
from ipapython.ipa_log_manager import root_logger, standard_logging_setup
from ipaserver.install.dsinstance import schema_dirname
@@ -65,7 +66,7 @@ def add_ca_schema():
pki_pent = pwd.getpwnam(PKI_USER)
ds_pent = pwd.getpwnam(DS_USER)
for schema_fname in SCHEMA_FILENAMES:
- source_fname = os.path.join(ipautil.SHARE_DIR, schema_fname)
+ source_fname = os.path.join(paths.USR_SHARE_IPA_DIR, schema_fname)
target_fname = os.path.join(schema_dirname(SERVERID), schema_fname)
if not os.path.exists(source_fname):
root_logger.debug('File does not exist: %s', source_fname)
diff --git a/ipaplatform/base/paths.py b/ipaplatform/base/paths.py
index 41712e9cd..47f518577 100644
--- a/ipaplatform/base/paths.py
+++ b/ipaplatform/base/paths.py
@@ -234,7 +234,6 @@ class BasePathNamespace(object):
HTML_KRBREALM_CON = "/usr/share/ipa/html/krbrealm.con"
NIS_ULDIF = "/usr/share/ipa/nis.uldif"
NIS_UPDATE_ULDIF = "/usr/share/ipa/nis-update.uldif"
- IPA_PLUGINS = "/usr/share/ipa/plugins"
SCHEMA_COMPAT_ULDIF = "/usr/share/ipa/schema_compat.uldif"
IPA_JS_PLUGINS_DIR = "/usr/share/ipa/ui/js/plugins"
UPDATES_DIR = "/usr/share/ipa/updates/"
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
index 3766eb344..57e05e26f 100644
--- a/ipaplatform/redhat/tasks.py
+++ b/ipaplatform/redhat/tasks.py
@@ -446,7 +446,7 @@ class RedHatTaskNamespace(BaseTaskNamespace):
os.mkdir(paths.SYSTEMD_SYSTEM_HTTPD_D_DIR, 0o755)
ipautil.copy_template_file(
- os.path.join(ipautil.SHARE_DIR, 'ipa-httpd.conf.template'),
+ os.path.join(paths.USR_SHARE_IPA_DIR, 'ipa-httpd.conf.template'),
paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF,
dict(
KRB5CC_HTTPD=paths.KRB5CC_HTTPD,
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index fcb2e3500..e613fd4d4 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -54,9 +54,6 @@ from ipapython import config
from ipaplatform.paths import paths
from ipapython.dn import DN
-SHARE_DIR = paths.USR_SHARE_IPA_DIR
-PLUGINS_SHARE_DIR = paths.IPA_PLUGINS
-
GEN_PWD_LEN = 22
GEN_TMP_PWD_LEN = 12 # only for OTP password that is manually retyped by user
diff --git a/ipaserver/advise/plugins/legacy_clients.py b/ipaserver/advise/plugins/legacy_clients.py
index 9e381f12a..7439f584a 100644
--- a/ipaserver/advise/plugins/legacy_clients.py
+++ b/ipaserver/advise/plugins/legacy_clients.py
@@ -20,8 +20,9 @@ import os
from ipalib import api
from ipalib.plugable import Registry
+from ipaplatform.paths import paths
from ipaserver.advise.base import Advice
-from ipapython.ipautil import template_file, SHARE_DIR
+from ipapython.ipautil import template_file
register = Registry()
@@ -67,7 +68,7 @@ class config_base_legacy_client(Advice):
def configure_and_start_sssd(self):
uri, base = self.get_uri_and_base()
template = os.path.join(
- SHARE_DIR,
+ paths.USR_SHARE_IPA_DIR,
'advise',
'legacy',
'sssd.conf.template'
@@ -132,7 +133,7 @@ class config_generic_linux_sssd_before_1_9(config_base_legacy_client):
self.check_compat_plugin()
with open(os.path.join(
- SHARE_DIR,
+ paths.USR_SHARE_IPA_DIR,
'advise',
'legacy',
'pam.conf.sssd.template')) as fd:
@@ -222,7 +223,7 @@ class config_generic_linux_nss_pam_ldapd(config_base_legacy_client):
self.check_compat_plugin()
with open(os.path.join(
- SHARE_DIR,
+ paths.USR_SHARE_IPA_DIR,
'advise',
'legacy',
'pam.conf.nss_pam_ldapd.template')) as fd:
@@ -289,7 +290,7 @@ class config_freebsd_nss_pam_ldapd(config_base_legacy_client):
self.check_compat_plugin()
with open(os.path.join(
- SHARE_DIR,
+ paths.USR_SHARE_IPA_DIR,
'advise',
'legacy',
'pam_conf_sshd.template')) as fd:
diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py
index 097637f75..e37d0ebdd 100644
--- a/ipaserver/dcerpc.py
+++ b/ipaserver/dcerpc.py
@@ -804,7 +804,8 @@ class DomainValidator(object):
if not self._creds:
self._parm = param.LoadParm()
- self._parm.load(os.path.join(ipautil.SHARE_DIR, "smb.conf.empty"))
+ self._parm.load(
+ os.path.join(paths.USR_SHARE_IPA_DIR, "smb.conf.empty"))
self._parm.set('netbios name', self.flatname)
self._creds = credentials.Credentials()
self._creds.set_kerberos_state(credentials.MUST_USE_KERBEROS)
@@ -868,7 +869,7 @@ class TrustDomainInstance(object):
def __init__(self, hostname, creds=None):
self.parm = param.LoadParm()
- self.parm.load(os.path.join(ipautil.SHARE_DIR, "smb.conf.empty"))
+ self.parm.load(os.path.join(paths.USR_SHARE_IPA_DIR, "smb.conf.empty"))
if len(hostname) > 0:
self.parm.set('netbios name', hostname)
self.creds = creds
diff --git a/ipaserver/install/adtrustinstance.py b/ipaserver/install/adtrustinstance.py
index 22a4a1d57..dda87d8aa 100644
--- a/ipaserver/install/adtrustinstance.py
+++ b/ipaserver/install/adtrustinstance.py
@@ -504,7 +504,7 @@ class ADTRUSTInstance(service.Service):
self.print_msg(UPGRADE_ERROR % dict(dn=targets_dn))
def __write_smb_registry(self):
- template = os.path.join(ipautil.SHARE_DIR, "smb.conf.template")
+ template = os.path.join(paths.USR_SHARE_IPA_DIR, "smb.conf.template")
conf = ipautil.template_file(template, self.sub_dict)
[tmp_fd, tmp_name] = tempfile.mkstemp()
os.write(tmp_fd, conf)
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index a944be2bb..89a280ae5 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -913,7 +913,9 @@ class BindInstance(service.Service):
if not self.fstore.has_file(NAMED_CONF):
self.fstore.backup_file(NAMED_CONF)
- named_txt = ipautil.template_file(ipautil.SHARE_DIR + "bind.named.conf.template", self.sub_dict)
+ named_txt = ipautil.template_file(
+ os.path.join(paths.USR_SHARE_IPA_DIR, "bind.named.conf.template"),
+ self.sub_dict)
named_fd = open(NAMED_CONF, 'w')
named_fd.seek(0)
named_fd.truncate(0)
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index e70253b01..505232ce0 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -1324,7 +1324,7 @@ def replica_ca_install_check(config, promote):
'on them: %s\n'
'If you are certain that this is a false positive, use '
'--skip-schema-check.',
- os.path.join(ipautil.SHARE_DIR, 'copy-schema-to-ca.py'))
+ os.path.join(paths.USR_SHARE_IPA_DIR, 'copy-schema-to-ca.py'))
exit('IPA schema missing on master CA directory server')
diff --git a/ipaserver/install/custodiainstance.py b/ipaserver/install/custodiainstance.py
index 604a6da3e..a0bb399d5 100644
--- a/ipaserver/install/custodiainstance.py
+++ b/ipaserver/install/custodiainstance.py
@@ -40,7 +40,7 @@ class CustodiaInstance(SimpleServiceInstance):
def __config_file(self):
template_file = os.path.basename(self.config_file) + '.template'
- template = os.path.join(ipautil.SHARE_DIR, template_file)
+ template = os.path.join(paths.USR_SHARE_IPA_DIR, template_file)
httpd_info = pwd.getpwnam(constants.HTTPD_USER)
sub_dict = dict(IPA_CUSTODIA_CONF_DIR=paths.IPA_CUSTODIA_CONF_DIR,
IPA_CUSTODIA_SOCKET=paths.IPA_CUSTODIA_SOCKET,
diff --git a/ipaserver/install/dogtaginstance.py b/ipaserver/install/dogtaginstance.py
index 0275f4e93..f4856c75e 100644
--- a/ipaserver/install/dogtaginstance.py
+++ b/ipaserver/install/dogtaginstance.py
@@ -258,7 +258,8 @@ class DogtagInstance(service.Service):
def http_proxy(self):
""" Update the http proxy file """
- template_filename = ipautil.SHARE_DIR + "ipa-pki-proxy.conf"
+ template_filename = (
+ os.path.join(paths.USR_SHARE_IPA_DIR, "ipa-pki-proxy.conf"))
sub_dict = dict(
DOGTAG_PORT=8009,
CLONE='' if self.clone else '#',
diff --git a/ipaserver/install/dsinstance.py b/ipaserver/install/dsinstance.py
index f0772e22e..397e3fcc2 100644
--- a/ipaserver/install/dsinstance.py
+++ b/ipaserver/install/dsinstance.py
@@ -607,7 +607,9 @@ class DsInstance(service.Service):
pent = pwd.getpwnam(DS_USER)
for schema_fname in IPA_SCHEMA_FILES:
target_fname = schema_dirname(self.serverid) + schema_fname
- shutil.copyfile(ipautil.SHARE_DIR + schema_fname, target_fname)
+ shutil.copyfile(
+ os.path.join(paths.USR_SHARE_IPA_DIR, schema_fname),
+ target_fname)
os.chmod(target_fname, 0o440) # read access for dirsrv user/group
os.chown(target_fname, pent.pw_uid, pent.pw_gid)
@@ -616,7 +618,9 @@ class DsInstance(service.Service):
schema_dirname(self.serverid) + "05rfc2247.ldif.old")
target_fname = schema_dirname(self.serverid) + "05rfc2247.ldif"
- shutil.copyfile(ipautil.SHARE_DIR + "05rfc2247.ldif", target_fname)
+ shutil.copyfile(
+ os.path.join(paths.USR_SHARE_IPA_DIR, "05rfc2247.ldif"),
+ target_fname)
os.chmod(target_fname, 0o440)
os.chown(target_fname, pent.pw_uid, pent.pw_gid)
except IOError:
@@ -919,8 +923,9 @@ class DsInstance(service.Service):
self._ldap_mod("indices.ldif")
def __certmap_conf(self):
- shutil.copyfile(ipautil.SHARE_DIR + "certmap.conf.template",
- config_dirname(self.serverid) + "certmap.conf")
+ shutil.copyfile(
+ os.path.join(paths.USR_SHARE_IPA_DIR, "certmap.conf.template"),
+ os.path.join(config_dirname(self.serverid), "certmap.conf"))
installutils.update_file(config_dirname(self.serverid) + "certmap.conf",
'$SUBJECT_BASE', str(self.subject_base))
sysupgrade.set_upgrade_state(
diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py
index b027e5c82..15c310780 100644
--- a/ipaserver/install/httpinstance.py
+++ b/ipaserver/install/httpinstance.py
@@ -215,7 +215,8 @@ class HTTPInstance(service.Service):
self.update_httpd_service_ipa_conf()
target_fname = paths.HTTPD_IPA_CONF
- http_txt = ipautil.template_file(ipautil.SHARE_DIR + "ipa.conf", self.sub_dict)
+ http_txt = ipautil.template_file(
+ os.path.join(paths.USR_SHARE_IPA_DIR, "ipa.conf"), self.sub_dict)
self.fstore.backup_file(paths.HTTPD_IPA_CONF)
http_fd = open(target_fname, "w")
http_fd.write(http_txt)
@@ -223,7 +224,9 @@ class HTTPInstance(service.Service):
os.chmod(target_fname, 0o644)
target_fname = paths.HTTPD_IPA_REWRITE_CONF
- http_txt = ipautil.template_file(ipautil.SHARE_DIR + "ipa-rewrite.conf", self.sub_dict)
+ http_txt = ipautil.template_file(
+ os.path.join(paths.USR_SHARE_IPA_DIR, "ipa-rewrite.conf"),
+ self.sub_dict)
self.fstore.backup_file(paths.HTTPD_IPA_REWRITE_CONF)
http_fd = open(target_fname, "w")
http_fd.write(http_txt)
@@ -457,7 +460,9 @@ class HTTPInstance(service.Service):
target_fname = paths.HTTPD_IPA_KDCPROXY_CONF
sub_dict = dict(KDCPROXY_CONFIG=paths.KDCPROXY_CONFIG)
http_txt = ipautil.template_file(
- ipautil.SHARE_DIR + "ipa-kdc-proxy.conf.template", sub_dict)
+ os.path.join(paths.USR_SHARE_IPA_DIR,
+ "ipa-kdc-proxy.conf.template"),
+ sub_dict)
self.fstore.backup_file(target_fname)
with open(target_fname, 'w') as f:
f.write(http_txt)
diff --git a/ipaserver/install/krbinstance.py b/ipaserver/install/krbinstance.py
index fddbde75c..fc764b425 100644
--- a/ipaserver/install/krbinstance.py
+++ b/ipaserver/install/krbinstance.py
@@ -250,7 +250,8 @@ class KrbInstance(service.Service):
self._ldap_mod("default-aci.ldif", self.sub_dict)
def __template_file(self, path, chmod=0o644):
- template = os.path.join(ipautil.SHARE_DIR, os.path.basename(path) + ".template")
+ template = os.path.join(paths.USR_SHARE_IPA_DIR,
+ os.path.basename(path) + ".template")
conf = ipautil.template_file(template, self.sub_dict)
self.fstore.backup_file(path)
fd = open(path, "w+")
diff --git a/ipaserver/install/opendnssecinstance.py b/ipaserver/install/opendnssecinstance.py
index 5bade7594..467f1f038 100644
--- a/ipaserver/install/opendnssecinstance.py
+++ b/ipaserver/install/opendnssecinstance.py
@@ -176,7 +176,8 @@ class OpenDNSSECInstance(service.Service):
sub_conf_dict['PIN'] = pin
ods_conf_txt = ipautil.template_file(
- ipautil.SHARE_DIR + "opendnssec_conf.template", sub_conf_dict)
+ os.path.join(paths.USR_SHARE_IPA_DIR, "opendnssec_conf.template"),
+ sub_conf_dict)
ods_conf_fd = open(paths.OPENDNSSEC_CONF_FILE, 'w')
ods_conf_fd.seek(0)
ods_conf_fd.truncate(0)
@@ -184,7 +185,8 @@ class OpenDNSSECInstance(service.Service):
ods_conf_fd.close()
ods_kasp_txt = ipautil.template_file(
- ipautil.SHARE_DIR + "opendnssec_kasp.template", self.kasp_file_dict)
+ os.path.join(paths.USR_SHARE_IPA_DIR, "opendnssec_kasp.template"),
+ self.kasp_file_dict)
ods_kasp_fd = open(paths.OPENDNSSEC_KASP_FILE, 'w')
ods_kasp_fd.seek(0)
ods_kasp_fd.truncate(0)
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
index 6277cd8b0..245450701 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -1547,12 +1547,15 @@ def upgrade_configuration():
ds_dirname = dsinstance.config_dirname(ds_serverid)
upgrade_file(sub_dict, paths.HTTPD_IPA_CONF,
- ipautil.SHARE_DIR + "ipa.conf")
+ os.path.join(paths.USR_SHARE_IPA_DIR, "ipa.conf"))
upgrade_file(sub_dict, paths.HTTPD_IPA_REWRITE_CONF,
- ipautil.SHARE_DIR + "ipa-rewrite.conf")
+ os.path.join(paths.USR_SHARE_IPA_DIR, "ipa-rewrite.conf"))
if ca.is_configured():
- upgrade_file(sub_dict, paths.HTTPD_IPA_PKI_PROXY_CONF,
- ipautil.SHARE_DIR + "ipa-pki-proxy.conf", add=True)
+ upgrade_file(
+ sub_dict,
+ paths.HTTPD_IPA_PKI_PROXY_CONF,
+ os.path.join(paths.USR_SHARE_IPA_DIR, "ipa-pki-proxy.conf"),
+ add=True)
else:
if ipautil.file_exists(paths.HTTPD_IPA_PKI_PROXY_CONF):
os.remove(paths.HTTPD_IPA_PKI_PROXY_CONF)
@@ -1560,7 +1563,7 @@ def upgrade_configuration():
upgrade_file(
sub_dict,
os.path.join(ds_dirname, "certmap.conf"),
- os.path.join(ipautil.SHARE_DIR, "certmap.conf.template")
+ os.path.join(paths.USR_SHARE_IPA_DIR, "certmap.conf.template")
)
upgrade_pki(ca, fstore)
@@ -1770,7 +1773,7 @@ def upgrade_check(options):
def upgrade():
realm = api.env.realm
- schema_files = [os.path.join(ipautil.SHARE_DIR, f) for f
+ schema_files = [os.path.join(paths.USR_SHARE_IPA_DIR, f) for f
in dsinstance.ALL_SCHEMA_FILES]
schema_files.extend(dsinstance.get_all_external_schema_files(
diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py
index 74a9fce11..35f2cd2b5 100644
--- a/ipaserver/install/service.py
+++ b/ipaserver/install/service.py
@@ -184,7 +184,7 @@ class Service(object):
ldap_uri=None, dm_password=None):
pw_name = None
fd = None
- path = ipautil.SHARE_DIR + ldif
+ path = os.path.join(paths.USR_SHARE_IPA_DIR, ldif)
nologlist = []
if sub_dict is not None: