summaryrefslogtreecommitdiffstats
path: root/pki/base/java-tools
diff options
context:
space:
mode:
authorjdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2010-11-19 20:52:28 +0000
committerjdennis <jdennis@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2010-11-19 20:52:28 +0000
commitae9091fc5539b221b2fe18bbc48bccf70be51081 (patch)
tree1ec8be9e8efc2da702ff88a07b044b063fefd447 /pki/base/java-tools
parentab00df3f879465faf73ef278074c5f4ef7760d66 (diff)
Clean up the instance registry
The initscripts for pki-* were significantly simplified. All logic related to managing the tomcat instance was completely eliminated! This is because we now use the unmodified tomcat6 initscript which ships with the tomcat6 package completely freeing us of having to know how to manage a tomcat instance. We simply defer to the definitive source, the tomcat6 package. This eliminated half the code in script, reducing it from 1831 lines to 885 lines! What remained was essentially the "pki registry" management, how we record what pki instances have been created on the system. There was also code to extract information from config files, this is used when reporting instance status. The registry management logic had been almost identically copied into the other KRC, OCSP & TKS initscrips. Copying complex code into multiple places is not good software engineering, rather the code should be defined in one location and then referenced. To this end the common shell code for the shared initscripts was isolated in a common file, pki/base/common/scripts/functions in our source tree and installed as /usr/share/pki/scripts/functions. The functions file is now 812 lines of code and shared amongst pki components. The shell code in functions was also made more robust, formerly it would try to extract string data out of files by using exact strings and string character counts, this varied slightly by each component. Now it just uses sed and regular expressions and won't break if someone adds a character to line in one of the files. With the pki registry logic isolated in a common file and by using the installed tomcat initscript we've now reduced the size of the initscript from 1,831 lines to a mere 73 lines! Just 4% of it's former size and in the process greatly increased robustness and maintainability. Each instance in the pki registry is defined by a configuration file. Formerly that file was created by the function construct_pki_instance_registry() in pkicreate. Although the purpose of construct_pki_instance_registry() is to write out a simple shell script it's implmentation was completly incomprehensible and unreadable. Since the resulting file is basically the same for different instances and subsytems and varies only by a minor amount of parametrization it a perfect candidate for a template file. We've now added a new template file base/*/setup/registry_instance which is easy to read and is processed by the exact same templating system which many of the other files are processed by. Also, formerly the registry instance file had shell logic it which is no longer necessary and has been removed. What we've ended up with is essentially just a set of shell variables (e.g. key/value pairs). Now the pki-* initscripts essentially just iterate over the instances located in the registry and invoke the initscript for the instance (which is ultimately just the standard tomcat6 initscript). This gives us yet another significant advantage. You can now control an instance using the normal "service" commands, there is no need to use the pki-* uber initscript to control instances. You can still do that if you wish, but now you can do the more obvious and natural service command on anything appearing in /etc/init.d. You can still use the pki-* uber initscripts to manage all instances of a subsystem if that makes more sense, but given there is likely to only be one instance of a subsystem installed on a machine being able to manage it directly and not needing to use an uber initscript to iterate a single instance yields something which is easier and more obvious to system administrators. The previous patch, "tomcat6_initscript", which updated the initscript logic discussed how a tomcat instance configuration file is installed in /etc/sysconfig under the instance name. Unfortunately that patch omitted the generation of that file which is generated using our templating facility. The source file pki/base/*/shared/conf/tomcat6.conf and replaces the previous tomcat5.conf file. For example if we are creating a pki-ca instance the file /usr/share/pki/ca/conf/tomcat6.conf will have substitutions performed on it and then it will be installed as /etc/sysconfig/pki-ca, which will be "sourced" by the standard tomcat6 initscript to parametrize the tomcat instance. This logically belonged in the previous "tomcat6_initscript" patch, but since this patch is also about initscript modifications it seems reasonable to include in the patch instead. git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@1549 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
Diffstat (limited to 'pki/base/java-tools')
0 files changed, 0 insertions, 0 deletions