diff options
author | Endi S. Dewata <edewata@redhat.com> | 2015-05-06 00:08:30 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2015-05-06 17:25:10 -0400 |
commit | 243cbf17ef88a3ec00980670f3918db925955c6c (patch) | |
tree | 67d33eac0528fce60f48c1cab618c94e8ae2d14b /base/server/python/pki/server/cli | |
parent | 2aa7ed131f4d229269088775513f23ec8b3793ec (diff) | |
download | pki-243cbf17ef88a3ec00980670f3918db925955c6c.tar.gz pki-243cbf17ef88a3ec00980670f3918db925955c6c.tar.xz pki-243cbf17ef88a3ec00980670f3918db925955c6c.zip |
Fixed migration tool to update Tomcat libraries.
The migration tool has been fixed to update the links to Tomcat
libraries in the instance folder to match the current Tomcat
version installed on the system.
https://fedorahosted.org/pki/ticket/1353
Diffstat (limited to 'base/server/python/pki/server/cli')
-rw-r--r-- | base/server/python/pki/server/cli/migrate.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/base/server/python/pki/server/cli/migrate.py b/base/server/python/pki/server/cli/migrate.py index 5b387cd67..bb807d8ca 100644 --- a/base/server/python/pki/server/cli/migrate.py +++ b/base/server/python/pki/server/cli/migrate.py @@ -106,6 +106,8 @@ class MigrateCLI(pki.cli.CLI): pki_context_xml = os.path.join(instance.conf_dir, 'Catalina', 'localhost', 'pki.xml') self.migrate_context_xml(pki_context_xml, tomcat_version) + self.migrate_tomcat_libraries(instance) + def migrate_server_xml(self, filename, tomcat_version): if self.verbose: @@ -379,6 +381,9 @@ class MigrateCLI(pki.cli.CLI): def migrate_context_xml(self, filename, tomcat_version): + if not os.path.exists(filename): + return + if self.verbose: print 'Migrating %s' % filename @@ -429,3 +434,35 @@ class MigrateCLI(pki.cli.CLI): context.append(resources) resources.set('allowLinking', 'true') + + def migrate_tomcat_libraries(self, instance): + + # remove old links + for filename in os.listdir(instance.lib_dir): + + if not filename.endswith('.jar'): + continue + + path = os.path.join(instance.lib_dir, filename) + + if self.verbose: + print 'Removing %s' % path + + os.remove(path) + + tomcat_dir = '/usr/share/tomcat/lib' + + # create new links + for filename in os.listdir(tomcat_dir): + + if not filename.endswith('.jar'): + continue + + source = os.path.join(tomcat_dir, filename) + dest = os.path.join(instance.lib_dir, filename) + + if self.verbose: + print 'Creating %s' % dest + + os.symlink(source, dest) + os.lchown(dest, instance.uid, instance.gid) |