summaryrefslogtreecommitdiffstats
path: root/base/server/python/pki/server
diff options
context:
space:
mode:
authorJack Magne <jmagne@localhost.localdomain>2014-12-11 20:20:40 -0800
committerJack Magne <jmagne@localhost.localdomain>2014-12-16 19:59:23 -0800
commit21d831010a7e0fe8d21e1ee286eb654bad6a21e3 (patch)
treecfcd0d878294ff4a57274ada8ae7492d96eaffc5 /base/server/python/pki/server
parent4083b0d6fd3af89cf638224d0081d9dd76eb1192 (diff)
downloadpki-21d831010a7e0fe8d21e1ee286eb654bad6a21e3.tar.gz
pki-21d831010a7e0fe8d21e1ee286eb654bad6a21e3.tar.xz
pki-21d831010a7e0fe8d21e1ee286eb654bad6a21e3.zip
Fix-for-Bug-1170867-TPS-Installation-Failed
Fix now includes last review comments where we decided to consolidate 3 of the ldif files: schema.ldif,database.ldif, and manager.ldif. Each one of these 3 files contains the data needed for any subsystem for that file. The subsystem specific files for these 3 go away in the source tree. The first iteration of this fix was copying these 3 files into an undesirable directory. This is no longer the case. Extra code in the python installer allows one to establish a "file exclusion" callback to keep a set of desired files from being copied when the installer does a directory copy. All subsystems have been tested, including TPS with a brand new DS (which was the original reason for this fix), and they appear to work fine. Addressed further review comments: 1. Removed trailing whitespace instances from schema.ldif which had some. 2. Used pycharm to remove the few PEP violations I had previously added to the Python code. 3. Changed the format of the schema.ldif file to make all the entries use the same style. Previously the TPS entries was using an all in one syntax. No more since now each entry is separate. 4. Changed the name of an argument in one of the new Python methods to get rid of a camelCase instance. 5. Tested everything to work as before, including basic TPS operations such as Format. Fixed a method comment string and fixed some typos.
Diffstat (limited to 'base/server/python/pki/server')
-rw-r--r--base/server/python/pki/server/deployment/pkihelper.py6
-rw-r--r--base/server/python/pki/server/deployment/pkimessages.py1
-rw-r--r--base/server/python/pki/server/deployment/scriptlets/instance_layout.py21
3 files changed, 22 insertions, 6 deletions
diff --git a/base/server/python/pki/server/deployment/pkihelper.py b/base/server/python/pki/server/deployment/pkihelper.py
index 96048bdec..9d2469dec 100644
--- a/base/server/python/pki/server/deployment/pkihelper.py
+++ b/base/server/python/pki/server/deployment/pkihelper.py
@@ -1329,8 +1329,10 @@ class Directory:
file_perms=config.PKI_DEPLOYMENT_DEFAULT_FILE_PERMISSIONS,
symlink_perms=config.PKI_DEPLOYMENT_DEFAULT_SYMLINK_PERMISSIONS,
dir_acls=None, file_acls=None, symlink_acls=None,
- recursive_flag=True, overwrite_flag=False, critical_failure=True):
+ recursive_flag=True, overwrite_flag=False, critical_failure=True,
+ ignore_cb=None):
try:
+
if not os.path.exists(old_name) or not os.path.isdir(old_name):
config.pki_log.error(
log.PKI_DIRECTORY_MISSING_OR_NOT_A_DIRECTORY_1, old_name,
@@ -1357,7 +1359,7 @@ class Directory:
# implementation's unchecked call to 'os.makedirs(dst)'.
# Consequently, a 'patched' local copy of this routine has
# been included in this file with the appropriate fix.
- pki_copytree(old_name, new_name)
+ pki_copytree(old_name, new_name, ignore=ignore_cb)
else:
# cp -p <old_name> <new_name>
config.pki_log.info(log.PKIHELPER_CP_P_2,
diff --git a/base/server/python/pki/server/deployment/pkimessages.py b/base/server/python/pki/server/deployment/pkimessages.py
index 2b12851cf..ecfbe5d0b 100644
--- a/base/server/python/pki/server/deployment/pkimessages.py
+++ b/base/server/python/pki/server/deployment/pkimessages.py
@@ -407,3 +407,4 @@ SKIP_SELINUX_SPAWN_1 = "skip populating '%s'"
SKIP_SLOT_ASSIGNMENT_SPAWN_1 = "skip assigning slots for '%s'"
SKIP_SUBSYSTEM_SPAWN_1 = "skip populating '%s'"
SKIP_WEBAPP_DEPLOYMENT_SPAWN_1 = "skip deploying '%s'"
+FILE_EXCLUDE_CALLBACK_2 = "file exclude callback src '%s' names '%s'"
diff --git a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
index 9cdecb4f2..16c3a7f76 100644
--- a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
+++ b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
@@ -1,6 +1,6 @@
#!/usr/bin/python -t
# Authors:
-# Matthew Harmsen <mharmsen@redhat.com>
+# Matthew Harmsen <mharmsen@redhat.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@
# System Imports
import os
-
# PKI Deployment Imports
from .. import pkiconfig as config
from .. import pkimessages as log
@@ -51,9 +50,11 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
deployer.directory.create(deployer.mdict['pki_instance_log_path'])
# establish Tomcat instance configuration
+ # don't copy over the common ldif files to etc instance path
deployer.directory.copy(
deployer.mdict['pki_source_server_path'],
- deployer.mdict['pki_instance_configuration_path'])
+ deployer.mdict['pki_instance_configuration_path'],
+ ignore_cb=file_ignore_callback_src_server)
# establish Tomcat instance base
deployer.directory.create(deployer.mdict['pki_tomcat_common_path'])
@@ -85,7 +86,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
# If desired and available,
# copy selected server theme
# to <instance>/webapps/pki
- if config.str2bool(deployer.mdict['pki_theme_enable']) and\
+ if config.str2bool(deployer.mdict['pki_theme_enable']) and \
os.path.exists(deployer.mdict['pki_theme_server_dir']):
deployer.directory.copy(
deployer.mdict['pki_theme_server_dir'],
@@ -311,3 +312,15 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
deployer.mdict['pki_instance_type_registry_path'])
return self.rv
+
+
+# Callback only when the /usr/share/pki/server/conf directory
+# Is getting copied to the etc tree.
+# Don't copy the shared ldif files:
+# schema.ldif, manager.ldif, database.ldif
+def file_ignore_callback_src_server(src, names):
+ config.pki_log.info(log.FILE_EXCLUDE_CALLBACK_2, src, names,
+ extra=config.PKI_INDENTATION_LEVEL_1)
+
+ excludes = {'schema.ldif', 'database.ldif', 'manager.ldif'}
+ return excludes