Blob Blame History Raw
From 09b673f3f4bbc5e9b70722bbe240e0347e3dd3fc Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftweedal@redhat.com>
Date: Fri, 11 Aug 2017 15:17:09 +1000
Subject: [PATCH] Fix FixDeploymentDescriptor upgrade script if source file is
 missing

On RHEL, the pki#admin.xml file may be absent, causing the
FixDeploymentDescriptor to break (and subsequent upgrade scriptlets
to not be executed).  Add a check that the source file exists.

Fixes: https://pagure.io/dogtagpki/issue/2789
Change-Id: I686e8fae534f8044cb1ce40b31e2462c4f0ac988
(cherry picked from commit d0a861923a27672d8633c87e21fb8596080e84af)
---
 base/server/upgrade/10.3.5/02-FixDeploymentDescriptor | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/base/server/upgrade/10.3.5/02-FixDeploymentDescriptor b/base/server/upgrade/10.3.5/02-FixDeploymentDescriptor
index 27c895980..858dbed43 100644
--- a/base/server/upgrade/10.3.5/02-FixDeploymentDescriptor
+++ b/base/server/upgrade/10.3.5/02-FixDeploymentDescriptor
@@ -46,6 +46,9 @@ class FixDeploymentDescriptor(pki.server.upgrade.PKIServerUpgradeScriptlet):
         source_xml = pki.SHARE_DIR + '/server/conf/Catalina/localhost/' + context_xml
         target_xml = instance.conf_dir + '/Catalina/localhost/' + context_xml
 
+        if not os.path.exists(source_xml):
+            return
+
         # if deployment descriptor doesn't exist, install the default
         if not os.path.exists(target_xml):
             self.copy_file(instance, source_xml, target_xml)
-- 
2.13.5