diff options
author | Endi S. Dewata <edewata@redhat.com> | 2016-07-24 07:36:36 +0200 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2016-07-28 00:02:14 +0200 |
commit | f990cb0dee46df211c2c7212ca0165465b5f3531 (patch) | |
tree | 27f8bcdea049c9e38cbb4eb1bc0bec44a84d449d | |
parent | 0c502a387c90d2e2d8ebe9e3edf3dfeaf1d6eba4 (diff) | |
download | pki-f990cb0dee46df211c2c7212ca0165465b5f3531.tar.gz pki-f990cb0dee46df211c2c7212ca0165465b5f3531.tar.xz pki-f990cb0dee46df211c2c7212ca0165465b5f3531.zip |
Added upgrade scripts to fix server library.
An upgrade script has been added to replace the <instance>/common
in existing instances with a link to /usr/share/pki/server/common
which contains links to server dependencies.
https://fedorahosted.org/pki/ticket/2403
-rw-r--r-- | base/common/upgrade/10.3.4/.gitignore | 4 | ||||
-rw-r--r-- | base/common/upgrade/10.3.5/.gitignore | 4 | ||||
-rw-r--r-- | base/server/upgrade/10.3.4/.gitignore | 4 | ||||
-rw-r--r-- | base/server/upgrade/10.3.5/01-FixServerLibrary | 46 |
4 files changed, 58 insertions, 0 deletions
diff --git a/base/common/upgrade/10.3.4/.gitignore b/base/common/upgrade/10.3.4/.gitignore new file mode 100644 index 000000000..5e7d2734c --- /dev/null +++ b/base/common/upgrade/10.3.4/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/base/common/upgrade/10.3.5/.gitignore b/base/common/upgrade/10.3.5/.gitignore new file mode 100644 index 000000000..5e7d2734c --- /dev/null +++ b/base/common/upgrade/10.3.5/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/base/server/upgrade/10.3.4/.gitignore b/base/server/upgrade/10.3.4/.gitignore new file mode 100644 index 000000000..5e7d2734c --- /dev/null +++ b/base/server/upgrade/10.3.4/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/base/server/upgrade/10.3.5/01-FixServerLibrary b/base/server/upgrade/10.3.5/01-FixServerLibrary new file mode 100644 index 000000000..79d496559 --- /dev/null +++ b/base/server/upgrade/10.3.5/01-FixServerLibrary @@ -0,0 +1,46 @@ +#!/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) 2016 Red Hat, Inc. +# All rights reserved. + +from __future__ import absolute_import +import os.path +import shutil +import pki.server.upgrade + + +class FixServerLibrary(pki.server.upgrade.PKIServerUpgradeScriptlet): + + def __init__(self): + super(FixServerLibrary, self).__init__() + self.message = 'Fix server library' + + def upgrade_instance(self, instance): + + common_dir = os.path.join(instance.base_dir, 'common') + + # if <instance>/common is already a link, skip + if os.path.islink(common_dir): + return + + # remove old <instance>/common + shutil.rmtree(common_dir) + + # link <instance>/common to /usr/share/pki/server/common + os.symlink('/usr/share/pki/server/common', common_dir) + os.lchown(common_dir, instance.uid, instance.gid) |