summaryrefslogtreecommitdiffstats
path: root/base/server/upgrade
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2017-01-19 20:50:42 +0100
committerEndi S. Dewata <edewata@redhat.com>2017-01-30 21:20:32 +0100
commit1ee44923b78684229e32301d57e74e770621fe9c (patch)
treeaae62cefbea90edfee38693c14414b272d687472 /base/server/upgrade
parent2fa7bc707a558da1b0c4d748d0805bdd0b60168c (diff)
downloadpki-1ee44923b78684229e32301d57e74e770621fe9c.tar.gz
pki-1ee44923b78684229e32301d57e74e770621fe9c.tar.xz
pki-1ee44923b78684229e32301d57e74e770621fe9c.zip
Merged /pki webapps.
Previously the /pki webapp was only added if the theme was present during installation, and there were separate webapps for /pki/admin and /pki/js. If the theme was installed later, the /pki webapp had to be configured manually. To simplify the installation and to support other developments (e.g. login banner), the /pki webapp will always be added during installation regardless of theme, and the /pki/admin and /pki/js webapps are merged into /pki webapp. When the theme package is installed, it will create links in /pki webapp so the theme files will become available without additional configuration. An upgrade script has been added to merge the /pki webapp in existing instances. https://fedorahosted.org/pki/ticket/2582
Diffstat (limited to 'base/server/upgrade')
-rwxr-xr-xbase/server/upgrade/10.4.0/02-MergePKIWebapps79
1 files changed, 79 insertions, 0 deletions
diff --git a/base/server/upgrade/10.4.0/02-MergePKIWebapps b/base/server/upgrade/10.4.0/02-MergePKIWebapps
new file mode 100755
index 000000000..4bd3deeee
--- /dev/null
+++ b/base/server/upgrade/10.4.0/02-MergePKIWebapps
@@ -0,0 +1,79 @@
+#!/usr/bin/python
+# Authors:
+# Endi S. Dewata <edewata@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) 2017 Red Hat, Inc.
+# All rights reserved.
+#
+
+from __future__ import absolute_import
+import os
+import shutil
+
+import pki
+
+
+class MergePKIWebapps(
+ pki.server.upgrade.PKIServerUpgradeScriptlet):
+
+ def __init__(self):
+ super(MergePKIWebapps, self).__init__()
+ self.message = 'Merge PKI webapps'
+
+ def upgrade_instance(self, instance):
+
+ # undeploy /pki/admin webapp
+
+ pki_admin_xml = os.path.join(
+ instance.conf_dir,
+ 'Catalina',
+ 'localhost',
+ 'pki#admin.xml')
+
+ self.backup(pki_admin_xml)
+ os.remove(pki_admin_xml)
+
+ # undeploy /pki/admin webapp
+
+ pki_js_xml = os.path.join(
+ instance.conf_dir,
+ 'Catalina',
+ 'localhost',
+ 'pki#js.xml')
+
+ self.backup(pki_js_xml)
+ os.remove(pki_js_xml)
+
+ # deploy /pki webapp (which includes /pki/admin and /pki/js)
+
+ source_pki_xml = os.path.join(
+ pki.SHARE_DIR,
+ 'server',
+ 'conf',
+ 'Catalina',
+ 'localhost',
+ 'pki.xml')
+
+ dest_pki_xml = os.path.join(
+ instance.conf_dir,
+ 'Catalina',
+ 'localhost',
+ 'pki.xml')
+
+ self.backup(dest_pki_xml)
+ shutil.copyfile(source_pki_xml, dest_pki_xml)
+ os.chown(dest_pki_xml, instance.uid, instance.gid)
+ os.chmod(dest_pki_xml, 0o0660)