[Pki-devel] [PATCH] 586 Added direct deployment for theme.

Endi Sukma Dewata edewata at redhat.com
Thu Apr 23 02:11:40 UTC 2015


The deployment tool has been modified to deploy the theme files
directly from /usr/share/pki. New deployment descriptors have been
added for admin templates and JS library.

https://fedorahosted.org/pki/ticket/499

-- 
Endi S. Dewata
-------------- next part --------------
From 9541a9ab8a10e972e1998e69b28a36d7d015d637 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata at redhat.com>
Date: Wed, 22 Apr 2015 18:33:11 -0400
Subject: [PATCH] Added direct deployment for theme.

The deployment tool has been modified to deploy the theme files
directly from /usr/share/pki. New deployment descriptors have been
added for admin templates and JS library.

https://fedorahosted.org/pki/ticket/499
---
 .../deployment/scriptlets/instance_layout.py       | 60 +++++++++++++---------
 .../tomcat7/conf/Catalina/localhost/ROOT.xml       |  2 +-
 .../conf/Catalina/localhost/pki#admin.xml}         |  4 +-
 .../conf/Catalina/localhost/pki#js.xml}            |  4 +-
 .../server/tomcat7/conf/Catalina/localhost/pki.xml |  2 +-
 .../tomcat8/conf/Catalina/localhost/ROOT.xml       |  2 +-
 .../Catalina/localhost/{pki.xml => pki#admin.xml}  |  2 +-
 .../Catalina/localhost/{pki.xml => pki#js.xml}     |  2 +-
 .../server/tomcat8/conf/Catalina/localhost/pki.xml |  2 +-
 9 files changed, 43 insertions(+), 37 deletions(-)
 copy base/server/{tomcat8/conf/Catalina/localhost/pki.xml => tomcat7/conf/Catalina/localhost/pki#admin.xml} (91%)
 copy base/server/{tomcat8/conf/Catalina/localhost/pki.xml => tomcat7/conf/Catalina/localhost/pki#js.xml} (91%)
 copy base/server/tomcat8/conf/Catalina/localhost/{pki.xml => pki#admin.xml} (93%)
 copy base/server/tomcat8/conf/Catalina/localhost/{pki.xml => pki#js.xml} (93%)

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 3a4d3faa394fc8cb433f838d7837df6a29924a45..ebcedc2e0de428b141d6a7a0f1f84c740193ca0c 100644
--- a/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
+++ b/base/server/python/pki/server/deployment/scriptlets/instance_layout.py
@@ -60,7 +60,9 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
             deployer.deploy_webapp(
                 "ROOT",
                 os.path.join(
-                    deployer.mdict['pki_tomcat_common_webapps_path'],
+                    config.PKI_DEPLOYMENT_SOURCE_ROOT,
+                    "server",
+                    "webapps",
                     "ROOT"),
                 os.path.join(
                     deployer.mdict['pki_source_server_path'],
@@ -68,18 +70,46 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                     "localhost",
                     "ROOT.xml"))
 
-            # Deploy pki web application
+            # Deploy theme web application
             deployer.deploy_webapp(
                 "pki",
-                os.path.join(
-                    deployer.mdict['pki_tomcat_common_webapps_path'],
-                    "pki"),
+                deployer.mdict['pki_theme_server_dir'],
                 os.path.join(
                     deployer.mdict['pki_source_server_path'],
                     "Catalina",
                     "localhost",
                     "pki.xml"))
 
+            # Deploy admin templates
+            deployer.deploy_webapp(
+                "pki#admin",
+                os.path.join(
+                    config.PKI_DEPLOYMENT_SOURCE_ROOT,
+                    "server",
+                    "webapps",
+                    "pki",
+                    "admin"),
+                os.path.join(
+                    deployer.mdict['pki_source_server_path'],
+                    "Catalina",
+                    "localhost",
+                    "pki#admin.xml"))
+
+            # Deploy JS library
+            deployer.deploy_webapp(
+                "pki#js",
+                os.path.join(
+                    config.PKI_DEPLOYMENT_SOURCE_ROOT,
+                    "server",
+                    "webapps",
+                    "pki",
+                    "js"),
+                os.path.join(
+                    deployer.mdict['pki_source_server_path'],
+                    "Catalina",
+                    "localhost",
+                    "pki#js.xml"))
+
             # establish Tomcat instance base
             deployer.directory.create(deployer.mdict['pki_tomcat_common_path'])
             deployer.directory.create(
@@ -99,26 +129,6 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
                 deployer.mdict['pki_instance_lib_log4j_properties'])
             deployer.directory.create(deployer.mdict['pki_tomcat_tmpdir_path'])
 
-            # Copy /usr/share/pki/server/webapps to <instance>/common/webapps
-            deployer.directory.copy(
-                os.path.join(
-                    config.PKI_DEPLOYMENT_SOURCE_ROOT,
-                    "server",
-                    "webapps"),
-                deployer.mdict['pki_tomcat_common_webapps_path'])
-
-            # If desired and available,
-            # copy selected server theme
-            # to <instance>/common/webapps/pki
-            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'],
-                    os.path.join(
-                        deployer.mdict['pki_tomcat_common_webapps_path'],
-                        "pki"),
-                    overwrite_flag=True)
-
             deployer.directory.create(deployer.mdict['pki_tomcat_work_path'])
             deployer.directory.create(
                 deployer.mdict['pki_tomcat_work_catalina_path'])
diff --git a/base/server/tomcat7/conf/Catalina/localhost/ROOT.xml b/base/server/tomcat7/conf/Catalina/localhost/ROOT.xml
index ce98bfa4ec98502b1f45aef4ce048c26de3f1f70..2a052f52c5468b6c5bdc62db7c98e47fd670a823 100644
--- a/base/server/tomcat7/conf/Catalina/localhost/ROOT.xml
+++ b/base/server/tomcat7/conf/Catalina/localhost/ROOT.xml
@@ -22,7 +22,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true" allowLinking="true">
+<Context docBase="/usr/share/pki/server/webapps/ROOT" crossContext="true" allowLinking="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
diff --git a/base/server/tomcat8/conf/Catalina/localhost/pki.xml b/base/server/tomcat7/conf/Catalina/localhost/pki#admin.xml
similarity index 91%
copy from base/server/tomcat8/conf/Catalina/localhost/pki.xml
copy to base/server/tomcat7/conf/Catalina/localhost/pki#admin.xml
index e70dd20558a1f72bd82625396dd9e8d43a45fbe4..e7f2e54a3ae3e9ead1b86cc8423ee6e68ee26286 100644
--- a/base/server/tomcat8/conf/Catalina/localhost/pki.xml
+++ b/base/server/tomcat7/conf/Catalina/localhost/pki#admin.xml
@@ -22,11 +22,9 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true">
+<Context docBase="/usr/share/pki/server/webapps/pki/admin" crossContext="true" allowLinking="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
 
-    <Resources allowLinking="true" />
-
 </Context>
diff --git a/base/server/tomcat8/conf/Catalina/localhost/pki.xml b/base/server/tomcat7/conf/Catalina/localhost/pki#js.xml
similarity index 91%
copy from base/server/tomcat8/conf/Catalina/localhost/pki.xml
copy to base/server/tomcat7/conf/Catalina/localhost/pki#js.xml
index e70dd20558a1f72bd82625396dd9e8d43a45fbe4..cef2f1c6ba949e811c7d627a937a7d8b7f2b4b93 100644
--- a/base/server/tomcat8/conf/Catalina/localhost/pki.xml
+++ b/base/server/tomcat7/conf/Catalina/localhost/pki#js.xml
@@ -22,11 +22,9 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true">
+<Context docBase="/usr/share/pki/server/webapps/pki/js" crossContext="true" allowLinking="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
 
-    <Resources allowLinking="true" />
-
 </Context>
diff --git a/base/server/tomcat7/conf/Catalina/localhost/pki.xml b/base/server/tomcat7/conf/Catalina/localhost/pki.xml
index ce98bfa4ec98502b1f45aef4ce048c26de3f1f70..77d1f27b1631b2d1e9d9922cbcc82ef8fddcd31e 100644
--- a/base/server/tomcat7/conf/Catalina/localhost/pki.xml
+++ b/base/server/tomcat7/conf/Catalina/localhost/pki.xml
@@ -22,7 +22,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true" allowLinking="true">
+<Context docBase="/usr/share/pki/common-ui" crossContext="true" allowLinking="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
diff --git a/base/server/tomcat8/conf/Catalina/localhost/ROOT.xml b/base/server/tomcat8/conf/Catalina/localhost/ROOT.xml
index e70dd20558a1f72bd82625396dd9e8d43a45fbe4..f7659800c05620f46254e6c6e92a1650b165d456 100644
--- a/base/server/tomcat8/conf/Catalina/localhost/ROOT.xml
+++ b/base/server/tomcat8/conf/Catalina/localhost/ROOT.xml
@@ -22,7 +22,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true">
+<Context docBase="/usr/share/pki/server/webapps/ROOT" crossContext="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
diff --git a/base/server/tomcat8/conf/Catalina/localhost/pki.xml b/base/server/tomcat8/conf/Catalina/localhost/pki#admin.xml
similarity index 93%
copy from base/server/tomcat8/conf/Catalina/localhost/pki.xml
copy to base/server/tomcat8/conf/Catalina/localhost/pki#admin.xml
index e70dd20558a1f72bd82625396dd9e8d43a45fbe4..16db436053f1b33617d55c0f64881a3d0afb6336 100644
--- a/base/server/tomcat8/conf/Catalina/localhost/pki.xml
+++ b/base/server/tomcat8/conf/Catalina/localhost/pki#admin.xml
@@ -22,7 +22,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true">
+<Context docBase="/usr/share/pki/server/webapps/pki/admin" crossContext="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
diff --git a/base/server/tomcat8/conf/Catalina/localhost/pki.xml b/base/server/tomcat8/conf/Catalina/localhost/pki#js.xml
similarity index 93%
copy from base/server/tomcat8/conf/Catalina/localhost/pki.xml
copy to base/server/tomcat8/conf/Catalina/localhost/pki#js.xml
index e70dd20558a1f72bd82625396dd9e8d43a45fbe4..9b0903ddf3ff8d113ed9c10877e67d423d6967aa 100644
--- a/base/server/tomcat8/conf/Catalina/localhost/pki.xml
+++ b/base/server/tomcat8/conf/Catalina/localhost/pki#js.xml
@@ -22,7 +22,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true">
+<Context docBase="/usr/share/pki/server/webapps/pki/js" crossContext="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
diff --git a/base/server/tomcat8/conf/Catalina/localhost/pki.xml b/base/server/tomcat8/conf/Catalina/localhost/pki.xml
index e70dd20558a1f72bd82625396dd9e8d43a45fbe4..1e87c1cd568c271c498d5aeff6ce7c2af6f8065a 100644
--- a/base/server/tomcat8/conf/Catalina/localhost/pki.xml
+++ b/base/server/tomcat8/conf/Catalina/localhost/pki.xml
@@ -22,7 +22,7 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<Context crossContext="true">
+<Context docBase="/usr/share/pki/common-ui" crossContext="true">
 
     <Manager
         secureRandomProvider="Mozilla-JSS" secureRandomAlgorithm="pkcs11prng"/>
-- 
1.9.3



More information about the Pki-devel mailing list