summaryrefslogtreecommitdiffstats
path: root/base/deploy/src/scriptlets/slot_substitution.py
diff options
context:
space:
mode:
authorMatthew Harmsen <mharmsen@redhat.com>2012-05-04 20:29:35 -0700
committerMatthew Harmsen <mharmsen@redhat.com>2012-05-07 11:28:10 -0700
commit391d345b5a6a1a905e3db4105a65dd4fdd0d19a9 (patch)
treecf73a152055f6bbc217c42bf8a8f0396ab3fd3dd /base/deploy/src/scriptlets/slot_substitution.py
parent9ad4d60592fdc37ae89672c29859b8463e183718 (diff)
downloadpki-391d345b5a6a1a905e3db4105a65dd4fdd0d19a9.tar.gz
pki-391d345b5a6a1a905e3db4105a65dd4fdd0d19a9.tar.xz
pki-391d345b5a6a1a905e3db4105a65dd4fdd0d19a9.zip
PKI Deployment Scriptlets
* Re-aligned code to account for revised layout documented at http://pki.fedoraproject.org/wiki/PKI_Instance_Deployment * Massaged logic to comply with PKI subsystem running within a shared instance * Developed code to take advantage of a single shared NSS security database model * Completed the following two 'scriptlets': * Dogtag 10: Python 'slot_assignment.py' Installation Scriptlet (https://fedorahosted.org/pki/ticket/146) * Dogtag 10: Python 'security_databases.py' Installation Scriptlet (https://fedorahosted.org/pki/ticket/136) * Created several additional PKI deployment helper utilities.
Diffstat (limited to 'base/deploy/src/scriptlets/slot_substitution.py')
-rw-r--r--base/deploy/src/scriptlets/slot_substitution.py120
1 files changed, 120 insertions, 0 deletions
diff --git a/base/deploy/src/scriptlets/slot_substitution.py b/base/deploy/src/scriptlets/slot_substitution.py
new file mode 100644
index 000000000..0a52af9f0
--- /dev/null
+++ b/base/deploy/src/scriptlets/slot_substitution.py
@@ -0,0 +1,120 @@
+#!/usr/bin/python -t
+# Authors:
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright (C) 2012 Red Hat, Inc.
+# All rights reserved.
+#
+
+# PKI Deployment Imports
+import pkiconfig as config
+from pkiconfig import pki_master_dict as master
+from pkiconfig import pki_slots_dict as slots
+import pkihelper as util
+import pkimessages as log
+import pkiscriptlet
+
+
+# PKI Deployment Instance Population Classes
+class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
+ rv = 0
+
+ def spawn(self):
+ config.pki_log.info(log.SLOT_ASSIGNMENT_SPAWN_1, __name__,
+ extra=config.PKI_INDENTATION_LEVEL_1)
+ util.file.copy_with_slot_substitution(master['pki_source_cs_cfg'],
+ master['pki_target_cs_cfg'])
+ util.file.copy_with_slot_substitution(master['pki_source_registry'],
+ master['pki_target_registry'])
+ if master['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS:
+ util.file.copy_with_slot_substitution(
+ master['pki_source_catalina_properties'],
+ master['pki_target_catalina_properties'])
+ util.file.copy_with_slot_substitution(
+ master['pki_source_servercertnick_conf'],
+ master['pki_target_servercertnick_conf'])
+ util.file.copy_with_slot_substitution(
+ master['pki_source_server_xml'],
+ master['pki_target_server_xml'])
+ util.file.copy_with_slot_substitution(
+ master['pki_source_tomcat_conf'],
+ master['pki_target_tomcat_conf'],
+ overwrite_flag=True)
+ util.file.copy_with_slot_substitution(
+ master['pki_source_index_jsp'],
+ master['pki_target_index_jsp'],
+ overwrite_flag=True)
+ util.file.apply_slot_substitution(
+ master['pki_target_velocity_properties'])
+ util.file.apply_slot_substitution(
+ master['pki_target_subsystem_web_xml'])
+ if master['pki_subsystem'] == "CA":
+ util.file.copy_with_slot_substitution(
+ master['pki_source_proxy_conf'],
+ master['pki_target_proxy_conf'])
+ util.file.apply_slot_substitution(
+ master['pki_target_profileselect_template'])
+ return self.rv
+
+ def respawn(self):
+ config.pki_log.info(log.SLOT_ASSIGNMENT_RESPAWN_1, __name__,
+ extra=config.PKI_INDENTATION_LEVEL_1)
+ util.file.copy_with_slot_substitution(master['pki_source_cs_cfg'],
+ master['pki_target_cs_cfg'],
+ overwrite_flag=True)
+ util.file.copy_with_slot_substitution(master['pki_source_registry'],
+ master['pki_target_registry'],
+ overwrite_flag=True)
+ if master['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS:
+ util.file.copy_with_slot_substitution(
+ master['pki_source_catalina_properties'],
+ master['pki_target_catalina_properties'],
+ overwrite_flag=True)
+ util.file.copy_with_slot_substitution(
+ master['pki_source_servercertnick_conf'],
+ master['pki_target_servercertnick_conf'],
+ overwrite_flag=True)
+ util.file.copy_with_slot_substitution(
+ master['pki_source_server_xml'],
+ master['pki_target_server_xml'],
+ overwrite_flag=True)
+ util.file.copy_with_slot_substitution(
+ master['pki_source_tomcat_conf'],
+ master['pki_target_tomcat_conf'],
+ overwrite_flag=True)
+ util.file.copy_with_slot_substitution(
+ master['pki_source_index_jsp'],
+ master['pki_target_index_jsp'],
+ overwrite_flag=True)
+ util.file.apply_slot_substitution(
+ master['pki_target_velocity_properties'])
+ util.file.apply_slot_substitution(
+ master['pki_target_subsystem_web_xml'])
+ if master['pki_subsystem'] == "CA":
+ util.file.copy_with_slot_substitution(
+ master['pki_source_proxy_conf'],
+ master['pki_target_proxy_conf'],
+ overwrite_flag=True)
+ util.file.apply_slot_substitution(
+ master['pki_target_profileselect_template'])
+ return self.rv
+
+ def destroy(self):
+ config.pki_log.info(log.SLOT_ASSIGNMENT_DESTROY_1, __name__,
+ extra=config.PKI_INDENTATION_LEVEL_1)
+ config.pki_log.info("NOTHING NEEDS TO BE IMPLEMENTED",
+ extra=config.PKI_INDENTATION_LEVEL_2)
+ return self.rv