[Pki-devel] [PATCH] 596 Fixed problem redeploying subsystem.

Endi Sukma Dewata edewata at redhat.com
Thu May 14 04:52:16 UTC 2015


The pki-server subsystem-enable CLI has been modified to deploy
the subsystem from a custom location if available, or from the
default location otherwise.

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

-- 
Endi S. Dewata
-------------- next part --------------
From 423024f87b7a68287d6a10f2c8f39f125250217d Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata at redhat.com>
Date: Thu, 14 May 2015 00:42:07 -0400
Subject: [PATCH] Fixed problem redeploying subsystem.

The pki-server subsystem-enable CLI has been modified to deploy
the subsystem from a custom location if available, or from the
default location otherwise.

https://fedorahosted.org/pki/ticket/1381
---
 base/server/python/pki/server/__init__.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/base/server/python/pki/server/__init__.py b/base/server/python/pki/server/__init__.py
index bc53598d43690d090576deedc7340c90d9f6502b..9777d221f9537f38e2466c34a0072d5fd5430aec 100644
--- a/base/server/python/pki/server/__init__.py
+++ b/base/server/python/pki/server/__init__.py
@@ -61,10 +61,10 @@ class PKISubsystem(object):
 
         if self.type >= 10:
             self.base_dir = os.path.join(self.instance.base_dir, self.name)
-            self.conf_dir = os.path.join(self.base_dir, 'conf')
         else:
             self.base_dir = instance.base_dir
-            self.conf_dir = os.path.join(self.base_dir, 'conf')
+
+        self.conf_dir = os.path.join(self.base_dir, 'conf')
 
         self.context_xml_template = os.path.join(
             pki.SHARE_DIR, self.name, 'conf', 'Catalina', 'localhost', self.name + '.xml')
@@ -72,6 +72,7 @@ class PKISubsystem(object):
         self.context_xml = os.path.join(
             instance.conf_dir, 'Catalina', 'localhost', self.name + '.xml')
 
+        # custom subsystem location
         self.doc_base = os.path.join(self.base_dir, 'webapps', self.name)
 
     def is_valid(self):
@@ -87,7 +88,16 @@ class PKISubsystem(object):
         return self.instance.is_deployed(self.name)
 
     def enable(self):
-        self.instance.deploy(self.name, self.context_xml_template, self.doc_base)
+        if os.path.exists(self.doc_base):
+            # deploy custom subsystem if exists
+            doc_base = self.doc_base
+
+        else:
+            # otherwise deploy default subsystem directly from
+            # /usr/share/pki/<subsystem>/webapps/<subsystem>
+            doc_base = None
+
+        self.instance.deploy(self.name, self.context_xml_template, doc_base)
 
     def disable(self):
         self.instance.undeploy(self.name)
-- 
1.9.3



More information about the Pki-devel mailing list