summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2013-11-27 11:53:57 -0500
committerEndi S. Dewata <edewata@redhat.com>2013-12-16 19:15:42 -0500
commit5952a82975063c4ec27303091a44e586d1386933 (patch)
tree45e85faf77b727e608062eba7ff32b512286d0f8 /base
parent706c37274c36a219ba6b0ece995bb36e7072b5e8 (diff)
downloadpki-5952a82975063c4ec27303091a44e586d1386933.tar.gz
pki-5952a82975063c4ec27303091a44e586d1386933.tar.xz
pki-5952a82975063c4ec27303091a44e586d1386933.zip
Moved web application context file.
The location of web application context file has been changed from <instance>/webapps/<name>/META-INF/context.xml into <instance>/conf/Catalina/localhost/<name>.xml. This will eventually allow deploying the web application directly from the shared folder. A new upgrade script has been added to move the context files in the existing instances. Ticket #499
Diffstat (limited to 'base')
-rw-r--r--base/ca/shared/conf/Catalina/localhost/ca.xml (renamed from base/ca/shared/webapps/ca/META-INF/context.xml)0
-rw-r--r--base/ca/shared/conf/context.xml40
-rw-r--r--base/common/python/pki/util.py15
-rw-r--r--base/common/upgrade/10.1.0/.gitignore4
-rw-r--r--base/common/upgrade/10.1.99/.gitignore4
-rw-r--r--base/kra/shared/conf/Catalina/localhost/kra.xml (renamed from base/kra/shared/webapps/kra/META-INF/context.xml)0
-rw-r--r--base/kra/shared/conf/context.xml40
-rw-r--r--base/ocsp/shared/conf/Catalina/localhost/ocsp.xml (renamed from base/ocsp/shared/webapps/ocsp/META-INF/context.xml)0
-rw-r--r--base/ocsp/shared/conf/context.xml40
-rw-r--r--base/server/etc/default.cfg3
-rw-r--r--base/server/python/pki/server/deployment/scriptlets/instance_layout.py69
-rw-r--r--base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py96
-rw-r--r--base/server/share/conf/Catalina/localhost/ROOT.xml (renamed from base/server/share/webapps/ROOT/META-INF/context.xml)0
-rw-r--r--base/server/share/conf/Catalina/localhost/pki.xml (renamed from base/server/share/webapps/pki/META-INF/context.xml)0
-rwxr-xr-xbase/server/upgrade/10.0.99/04-FixLogFileOwnership12
-rw-r--r--base/server/upgrade/10.1.0/.gitignore4
-rwxr-xr-xbase/server/upgrade/10.1.99/01-MoveWebApplicationContextFile96
-rw-r--r--base/tks/shared/conf/Catalina/localhost/tks.xml (renamed from base/tks/shared/webapps/tks/META-INF/context.xml)0
-rw-r--r--base/tks/shared/conf/context.xml40
-rw-r--r--base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml (renamed from base/tps-tomcat/shared/webapps/tps/META-INF/context.xml)0
-rw-r--r--base/tps-tomcat/shared/conf/context.xml40
21 files changed, 203 insertions, 300 deletions
diff --git a/base/ca/shared/webapps/ca/META-INF/context.xml b/base/ca/shared/conf/Catalina/localhost/ca.xml
index e838503a6..e838503a6 100644
--- a/base/ca/shared/webapps/ca/META-INF/context.xml
+++ b/base/ca/shared/conf/Catalina/localhost/ca.xml
diff --git a/base/ca/shared/conf/context.xml b/base/ca/shared/conf/context.xml
deleted file mode 100644
index 8b6fe4905..000000000
--- a/base/ca/shared/conf/context.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!-- BEGIN COPYRIGHT BLOCK
- Copyright (C) 2006-2010 Red Hat, Inc.
- All rights reserved.
- Modifications: configuration parameters
- END COPYRIGHT BLOCK -->
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- The contents of this file will be loaded for each web application -->
-<Context crossContext="true" allowLinking="true">
-
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
-
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!--
- <Manager pathname="" />
- -->
-
- <!-- Uncomment this to enable Comet connection tacking (provides events
- on session expiration as well as webapp lifecycle) -->
- <!--
- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
- -->
-
-</Context>
diff --git a/base/common/python/pki/util.py b/base/common/python/pki/util.py
index 62aec2c47..a0481852d 100644
--- a/base/common/python/pki/util.py
+++ b/base/common/python/pki/util.py
@@ -97,3 +97,18 @@ def copydirs(source, dest):
os.utime(dest, (st.st_atime, st.st_mtime))
os.chmod(dest, st.st_mode)
os.chown(dest, st.st_uid, st.st_gid)
+
+def chown(path, uid, gid):
+ """
+ Change ownership of a folder and its contents.
+ """
+
+ os.chown(path, uid, gid)
+
+ for item in os.listdir(path):
+ itempath = os.path.join(path, item)
+
+ if os.path.isfile(itempath):
+ os.chown(itempath, uid, gid)
+ elif os.path.isdir(itempath):
+ chown(itempath, uid, gid)
diff --git a/base/common/upgrade/10.1.0/.gitignore b/base/common/upgrade/10.1.0/.gitignore
new file mode 100644
index 000000000..5e7d2734c
--- /dev/null
+++ b/base/common/upgrade/10.1.0/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
diff --git a/base/common/upgrade/10.1.99/.gitignore b/base/common/upgrade/10.1.99/.gitignore
new file mode 100644
index 000000000..5e7d2734c
--- /dev/null
+++ b/base/common/upgrade/10.1.99/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
diff --git a/base/kra/shared/webapps/kra/META-INF/context.xml b/base/kra/shared/conf/Catalina/localhost/kra.xml
index e838503a6..e838503a6 100644
--- a/base/kra/shared/webapps/kra/META-INF/context.xml
+++ b/base/kra/shared/conf/Catalina/localhost/kra.xml
diff --git a/base/kra/shared/conf/context.xml b/base/kra/shared/conf/context.xml
deleted file mode 100644
index 8b6fe4905..000000000
--- a/base/kra/shared/conf/context.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!-- BEGIN COPYRIGHT BLOCK
- Copyright (C) 2006-2010 Red Hat, Inc.
- All rights reserved.
- Modifications: configuration parameters
- END COPYRIGHT BLOCK -->
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- The contents of this file will be loaded for each web application -->
-<Context crossContext="true" allowLinking="true">
-
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
-
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!--
- <Manager pathname="" />
- -->
-
- <!-- Uncomment this to enable Comet connection tacking (provides events
- on session expiration as well as webapp lifecycle) -->
- <!--
- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
- -->
-
-</Context>
diff --git a/base/ocsp/shared/webapps/ocsp/META-INF/context.xml b/base/ocsp/shared/conf/Catalina/localhost/ocsp.xml
index e838503a6..e838503a6 100644
--- a/base/ocsp/shared/webapps/ocsp/META-INF/context.xml
+++ b/base/ocsp/shared/conf/Catalina/localhost/ocsp.xml
diff --git a/base/ocsp/shared/conf/context.xml b/base/ocsp/shared/conf/context.xml
deleted file mode 100644
index 8b6fe4905..000000000
--- a/base/ocsp/shared/conf/context.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!-- BEGIN COPYRIGHT BLOCK
- Copyright (C) 2006-2010 Red Hat, Inc.
- All rights reserved.
- Modifications: configuration parameters
- END COPYRIGHT BLOCK -->
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- The contents of this file will be loaded for each web application -->
-<Context crossContext="true" allowLinking="true">
-
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
-
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!--
- <Manager pathname="" />
- -->
-
- <!-- Uncomment this to enable Comet connection tacking (provides events
- on session expiration as well as webapp lifecycle) -->
- <!--
- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
- -->
-
-</Context>
diff --git a/base/server/etc/default.cfg b/base/server/etc/default.cfg
index b83fb144d..94d34b201 100644
--- a/base/server/etc/default.cfg
+++ b/base/server/etc/default.cfg
@@ -244,9 +244,6 @@ pki_tomcat_common_path=%(pki_instance_path)s/common
pki_tomcat_common_lib_path=%(pki_tomcat_common_path)s/lib
pki_tomcat_tmpdir_path=%(pki_instance_path)s/temp
pki_tomcat_webapps_path=%(pki_instance_path)s/webapps
-pki_tomcat_webapps_root_path=%(pki_tomcat_webapps_path)s/ROOT
-pki_tomcat_webapps_common_path=%(pki_tomcat_webapps_path)s/pki
-pki_tomcat_webapps_root_webinf_path=%(pki_tomcat_webapps_root_path)s/WEB-INF
pki_tomcat_work_path=%(pki_instance_path)s/work
pki_tomcat_work_catalina_path=%(pki_tomcat_work_path)s/Catalina
pki_tomcat_work_catalina_host_path=%(pki_tomcat_work_catalina_path)s/localhost
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 6ca9a374d..86968e22e 100644
--- a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
+++ b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
@@ -39,18 +39,22 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
config.pki_log.info(log.SKIP_INSTANCE_SPAWN_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
return self.rv
+
config.pki_log.info(log.INSTANCE_SPAWN_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
- # establish instance logs
- deployer.directory.create(deployer.master_dict['pki_instance_log_path'])
- # establish instance configuration
- deployer.directory.create(deployer.master_dict['pki_instance_configuration_path'])
- # establish Apache/Tomcat specific instance
- if deployer.master_dict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS:
+
+ # if this is the first subsystem
+ if deployer.master_dict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS and\
+ len(deployer.instance.tomcat_instance_subsystems()) == 1:
+
+ # establish instance logs
+ deployer.directory.create(deployer.master_dict['pki_instance_log_path'])
+
# establish Tomcat instance configuration
- deployer.directory.copy(deployer.master_dict['pki_source_server_path'],
- deployer.master_dict['pki_instance_configuration_path'],
- overwrite_flag=True)
+ deployer.directory.copy(
+ deployer.master_dict['pki_source_server_path'],
+ deployer.master_dict['pki_instance_configuration_path'])
+
# establish Tomcat instance base
deployer.directory.create(deployer.master_dict['pki_tomcat_common_path'])
deployer.directory.create(deployer.master_dict['pki_tomcat_common_lib_path'])
@@ -67,7 +71,27 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
deployer.symlink.create(deployer.master_dict['pki_instance_conf_log4j_properties'],
deployer.master_dict['pki_instance_lib_log4j_properties'])
deployer.directory.create(deployer.master_dict['pki_tomcat_tmpdir_path'])
- deployer.directory.create(deployer.master_dict['pki_tomcat_webapps_path'])
+
+ # Copy /usr/share/pki/server/webapps to <instance>/webapps
+ deployer.directory.copy(
+ os.path.join(
+ config.PKI_DEPLOYMENT_SOURCE_ROOT,
+ "server",
+ "webapps"),
+ deployer.master_dict['pki_tomcat_webapps_path'])
+
+ # If desired and available,
+ # copy selected server theme
+ # to <instance>/webapps/pki
+ if config.str2bool(deployer.master_dict['pki_theme_enable']) and\
+ os.path.exists(deployer.master_dict['pki_theme_server_dir']):
+ deployer.directory.copy(
+ deployer.master_dict['pki_theme_server_dir'],
+ os.path.join(
+ deployer.master_dict['pki_tomcat_webapps_path'],
+ "pki"),
+ overwrite_flag=True)
+
deployer.directory.create(deployer.master_dict['pki_tomcat_work_path'])
deployer.directory.create(deployer.master_dict['pki_tomcat_work_catalina_path'])
deployer.directory.create(deployer.master_dict['pki_tomcat_work_catalina_host_path'])
@@ -120,9 +144,6 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
deployer.master_dict['pki_resteasy_jettison_provider_jar_link'])
deployer.symlink.create(deployer.master_dict['pki_scannotation_jar'],
deployer.master_dict['pki_scannotation_jar_link'])
- if deployer.master_dict['pki_subsystem'] == 'TKS':
- deployer.symlink.create(deployer.master_dict['pki_symkey_jar'],
- deployer.master_dict['pki_symkey_jar_link'])
deployer.symlink.create(deployer.master_dict['pki_tomcatjss_jar'],
deployer.master_dict['pki_tomcatjss_jar_link'])
deployer.symlink.create(deployer.master_dict['pki_velocity_jar'],
@@ -133,23 +154,31 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
deployer.master_dict['pki_xml_commons_apis_jar_link'])
deployer.symlink.create(deployer.master_dict['pki_xml_commons_resolver_jar'],
deployer.master_dict['pki_xml_commons_resolver_jar_link'])
- # establish shared NSS security databases for this instance
- deployer.directory.create(deployer.master_dict['pki_database_path'])
- # establish instance convenience symbolic links
- deployer.symlink.create(deployer.master_dict['pki_database_path'],
+
+ # establish shared NSS security databases for this instance
+ deployer.directory.create(deployer.master_dict['pki_database_path'])
+ # establish instance convenience symbolic links
+ deployer.symlink.create(deployer.master_dict['pki_database_path'],
deployer.master_dict['pki_instance_database_link'])
- deployer.symlink.create(deployer.master_dict['pki_instance_configuration_path'],
+ deployer.symlink.create(deployer.master_dict['pki_instance_configuration_path'],
deployer.master_dict['pki_instance_conf_link'])
- deployer.symlink.create(deployer.master_dict['pki_instance_log_path'],
+ deployer.symlink.create(deployer.master_dict['pki_instance_log_path'],
deployer.master_dict['pki_instance_logs_link'])
+
+ if deployer.master_dict['pki_subsystem'] == 'TKS':
+ deployer.symlink.create(deployer.master_dict['pki_symkey_jar'],
+ deployer.master_dict['pki_symkey_jar_link'])
+
return self.rv
def destroy(self, deployer):
config.pki_log.info(log.INSTANCE_DESTROY_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
+
if deployer.master_dict['pki_subsystem'] == 'TKS':
deployer.symlink.delete(deployer.master_dict['pki_symkey_jar_link'])
+
if deployer.master_dict['pki_subsystem'] in config.PKI_APACHE_SUBSYSTEMS and\
deployer.instance.apache_instance_subsystems() == 0:
# remove Apache instance base
@@ -165,6 +194,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
if deployer.instance.apache_instances() == 0:
deployer.directory.delete(
deployer.master_dict['pki_instance_type_registry_path'])
+
elif deployer.master_dict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS and\
len(deployer.instance.tomcat_instance_subsystems()) == 0:
# remove Tomcat instance base
@@ -183,4 +213,5 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
if deployer.instance.tomcat_instances() == 0:
deployer.directory.delete(
deployer.master_dict['pki_instance_type_registry_path'])
+
return self.rv
diff --git a/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py b/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py
index ccbf4ea90..70f2ccc88 100644
--- a/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py
+++ b/base/server/python/pki/server/deployment/scriptlets/webapp_deployment.py
@@ -40,76 +40,10 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
__name__,
extra=config.PKI_INDENTATION_LEVEL_1)
return self.rv
+
config.pki_log.info(log.WEBAPP_DEPLOYMENT_SPAWN_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
- # Copy /usr/share/pki/server/webapps/ROOT
- # to <instance>/webapps/ROOT
- deployer.directory.create(deployer.master_dict['pki_tomcat_webapps_root_path'])
- deployer.directory.copy(
- os.path.join(
- config.PKI_DEPLOYMENT_SOURCE_ROOT,
- "server",
- "webapps",
- "ROOT"),
- deployer.master_dict['pki_tomcat_webapps_root_path'],
- overwrite_flag=True)
-
- deployer.directory.create(deployer.master_dict['pki_tomcat_webapps_common_path'])
-
- # If desired and available,
- # copy selected server theme
- # to <instance>/webapps/pki
- if config.str2bool(deployer.master_dict['pki_theme_enable']) and\
- os.path.exists(deployer.master_dict['pki_theme_server_dir']):
- deployer.directory.copy(deployer.master_dict['pki_theme_server_dir'],
- deployer.master_dict['pki_tomcat_webapps_common_path'],
- overwrite_flag=True)
-
- # Copy /usr/share/pki/server/webapps/pki/js
- # to <instance>/webapps/pki/js
- deployer.directory.copy(
- os.path.join(
- config.PKI_DEPLOYMENT_SOURCE_ROOT,
- "server",
- "webapps",
- "pki",
- "js"),
- os.path.join(
- deployer.master_dict['pki_tomcat_webapps_common_path'],
- "js"),
- overwrite_flag=True)
-
- # Copy /usr/share/pki/server/webapps/pki/META-INF
- # to <instance>/webapps/pki/META-INF
- deployer.directory.copy(
- os.path.join(
- config.PKI_DEPLOYMENT_SOURCE_ROOT,
- "server",
- "webapps",
- "pki",
- "META-INF"),
- os.path.join(
- deployer.master_dict['pki_tomcat_webapps_common_path'],
- "META-INF"),
- overwrite_flag=True)
-
- # Copy /usr/share/pki/server/webapps/pki/admin
- # to <instance>/webapps/<subsystem>/admin
- # TODO: common templates should be deployed in common webapp
- deployer.directory.create(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
- deployer.directory.copy(
- os.path.join(
- config.PKI_DEPLOYMENT_SOURCE_ROOT,
- "server",
- "webapps",
- "pki",
- "admin"),
- os.path.join(
- deployer.master_dict['pki_tomcat_webapps_subsystem_path'],
- "admin"),
- overwrite_flag=True)
-
# Copy /usr/share/pki/<subsystem>/webapps/<subsystem>
# to <instance>/webapps/<subsystem>
deployer.directory.copy(
@@ -155,11 +89,39 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
deployer.master_dict['pki_tps_jar_link'])
# set ownerships, permissions, and acls
deployer.directory.set_mode(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
+
+ # Copy /usr/share/pki/<subsystem>/conf/Catalina/localhost/<subsystem>.xml
+ # to <instance>/conf/Catalina/localhost/<subsystem>.xml
+ deployer.file.copy(
+ os.path.join(
+ config.PKI_DEPLOYMENT_SOURCE_ROOT,
+ deployer.master_dict['pki_subsystem'].lower(),
+ "conf",
+ "Catalina",
+ "localhost",
+ deployer.master_dict['pki_subsystem'].lower() + ".xml"),
+ os.path.join(
+ deployer.master_dict['pki_instance_configuration_path'],
+ "Catalina",
+ "localhost",
+ deployer.master_dict['pki_subsystem'].lower() + ".xml"))
+
return self.rv
def destroy(self, deployer):
if deployer.master_dict['pki_subsystem'] in config.PKI_TOMCAT_SUBSYSTEMS:
config.pki_log.info(log.WEBAPP_DEPLOYMENT_DESTROY_1, __name__,
extra=config.PKI_INDENTATION_LEVEL_1)
+
+ # Delete <instance>/conf/Catalina/localhost/<subsystem>.xml
+ deployer.file.delete(
+ os.path.join(
+ deployer.master_dict['pki_instance_configuration_path'],
+ "Catalina",
+ "localhost",
+ deployer.master_dict['pki_subsystem'].lower() + ".xml"))
+
+ # Delete <instance>/webapps/<subsystem>
deployer.directory.delete(deployer.master_dict['pki_tomcat_webapps_subsystem_path'])
+
return self.rv
diff --git a/base/server/share/webapps/ROOT/META-INF/context.xml b/base/server/share/conf/Catalina/localhost/ROOT.xml
index ce98bfa4e..ce98bfa4e 100644
--- a/base/server/share/webapps/ROOT/META-INF/context.xml
+++ b/base/server/share/conf/Catalina/localhost/ROOT.xml
diff --git a/base/server/share/webapps/pki/META-INF/context.xml b/base/server/share/conf/Catalina/localhost/pki.xml
index ce98bfa4e..ce98bfa4e 100644
--- a/base/server/share/webapps/pki/META-INF/context.xml
+++ b/base/server/share/conf/Catalina/localhost/pki.xml
diff --git a/base/server/upgrade/10.0.99/04-FixLogFileOwnership b/base/server/upgrade/10.0.99/04-FixLogFileOwnership
index d7de7f96f..b63055f29 100755
--- a/base/server/upgrade/10.0.99/04-FixLogFileOwnership
+++ b/base/server/upgrade/10.0.99/04-FixLogFileOwnership
@@ -51,14 +51,4 @@ class FixLogFileOwnership(pki.server.upgrade.PKIServerUpgradeScriptlet):
log_dir = os.path.join('/var/log/pki', instance.name)
- self._chown(log_dir, uid, gid)
-
-
- def _chown(self, path, uid, gid):
- os.chown(path, uid, gid)
- for item in os.listdir(path):
- itempath = os.path.join(path, item)
- if os.path.isfile(itempath):
- os.chown(itempath, uid, gid)
- elif os.path.isdir(itempath):
- self._chown(itempath, uid, gid)
+ pki.util.chown(log_dir, uid, gid)
diff --git a/base/server/upgrade/10.1.0/.gitignore b/base/server/upgrade/10.1.0/.gitignore
new file mode 100644
index 000000000..5e7d2734c
--- /dev/null
+++ b/base/server/upgrade/10.1.0/.gitignore
@@ -0,0 +1,4 @@
+# Ignore everything in this directory
+*
+# Except this file
+!.gitignore
diff --git a/base/server/upgrade/10.1.99/01-MoveWebApplicationContextFile b/base/server/upgrade/10.1.99/01-MoveWebApplicationContextFile
new file mode 100755
index 000000000..f3bbf4477
--- /dev/null
+++ b/base/server/upgrade/10.1.99/01-MoveWebApplicationContextFile
@@ -0,0 +1,96 @@
+#!/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) 2013 Red Hat, Inc.
+# All rights reserved.
+#
+
+import grp
+import os
+import pwd
+import re
+
+import pki.server.upgrade
+
+
+class MoveWebApplicationContextFile(pki.server.upgrade.PKIServerUpgradeScriptlet):
+
+ def __init__(self):
+
+ self.message = 'Move web application context file'
+
+ def upgrade_instance(self, instance):
+
+ self.upgrade_webapp(instance, 'ROOT')
+ self.upgrade_webapp(instance, 'pki')
+
+ def upgrade_subsystem(self, instance, subsystem):
+
+ self.upgrade_webapp(instance, subsystem.name)
+
+ def upgrade_webapp(self, instance, webapp):
+
+ metainf_dir = os.path.join(instance.base_dir, 'webapps', webapp, 'META-INF')
+ self.backup(metainf_dir)
+
+ old_context_file = os.path.join(metainf_dir, 'context.xml')
+ self.backup(old_context_file)
+
+ catalina_dir = os.path.join(instance.base_dir, 'conf', 'Catalina')
+ self.backup(catalina_dir)
+
+ localhost_dir = os.path.join(catalina_dir, 'localhost')
+ self.backup(localhost_dir)
+
+ new_context_file = os.path.join(localhost_dir, webapp + '.xml')
+ self.backup(new_context_file)
+
+ # prepare target folder
+ if not os.path.exists(localhost_dir):
+ os.makedirs(localhost_dir)
+
+ # copy context file, don't overwrite existing file
+ pki.util.copyfile(old_context_file, new_context_file, overwrite=False)
+
+ # find uid and gid
+ registry_file = os.path.join(
+ pki.server.REGISTRY_DIR, 'tomcat', instance.name, instance.name)
+
+ with open(registry_file, 'r') as registry:
+ lines = registry.readlines()
+
+ for line in lines:
+ m = re.search('^PKI_USER=(.*)$', line)
+ if m:
+ user = m.group(1)
+ m = re.search('^PKI_GROUP=(.*)$', line)
+ if m:
+ group = m.group(1)
+
+ uid = pwd.getpwnam(user).pw_uid
+ gid = grp.getgrnam(group).gr_gid
+
+ # set file and folder ownership
+ pki.util.chown(catalina_dir, uid, gid)
+
+ # remove old context file
+ if os.path.exists(old_context_file):
+ os.remove(old_context_file)
+
+ # remove empty META-INF
+ if not os.listdir(metainf_dir):
+ os.rmdir(metainf_dir)
diff --git a/base/tks/shared/webapps/tks/META-INF/context.xml b/base/tks/shared/conf/Catalina/localhost/tks.xml
index e838503a6..e838503a6 100644
--- a/base/tks/shared/webapps/tks/META-INF/context.xml
+++ b/base/tks/shared/conf/Catalina/localhost/tks.xml
diff --git a/base/tks/shared/conf/context.xml b/base/tks/shared/conf/context.xml
deleted file mode 100644
index 8b6fe4905..000000000
--- a/base/tks/shared/conf/context.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!-- BEGIN COPYRIGHT BLOCK
- Copyright (C) 2006-2010 Red Hat, Inc.
- All rights reserved.
- Modifications: configuration parameters
- END COPYRIGHT BLOCK -->
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- The contents of this file will be loaded for each web application -->
-<Context crossContext="true" allowLinking="true">
-
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
-
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!--
- <Manager pathname="" />
- -->
-
- <!-- Uncomment this to enable Comet connection tacking (provides events
- on session expiration as well as webapp lifecycle) -->
- <!--
- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
- -->
-
-</Context>
diff --git a/base/tps-tomcat/shared/webapps/tps/META-INF/context.xml b/base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml
index e838503a6..e838503a6 100644
--- a/base/tps-tomcat/shared/webapps/tps/META-INF/context.xml
+++ b/base/tps-tomcat/shared/conf/Catalina/localhost/tps.xml
diff --git a/base/tps-tomcat/shared/conf/context.xml b/base/tps-tomcat/shared/conf/context.xml
deleted file mode 100644
index ba139add2..000000000
--- a/base/tps-tomcat/shared/conf/context.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!-- BEGIN COPYRIGHT BLOCK
- Copyright (C) 2006-2010 Red Hat, Inc.
- All rights reserved.
- Modifications: configuration parameters
- END COPYRIGHT BLOCK -->
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<!-- The contents of this file will be loaded for each web application -->
-<Context crossContext="true" allowLinking="true">
-
- <!-- Default set of monitored resources -->
- <WatchedResource>WEB-INF/web.xml</WatchedResource>
-
- <!-- Uncomment this to disable session persistence across Tomcat restarts -->
- <!--
- <Manager pathname="" />
- -->
-
- <!-- Uncomment this to enable Comet connection tacking (provides events
- on session expiration as well as webapp lifecycle) -->
- <!--
- <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
- -->
-
-</Context>