[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Pki-devel] [PATCH] 546 Disabling subsystem on selftest failure.



The SelfTestSubsystem has been modified such that if the selftest
fails it will invoke the pki-server CLI to undeploy and disable the
failing subsystem. The Tomcat instance and other subsystems not
depending on this subsystem will continue to run. Once the problem
is fixed, the admin can enable the subsystem again with the
pki-server CLI.

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

--
Endi S. Dewata
From c5c32691b4eb6441dc997d215ba69bfb5610595b Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata redhat com>
Date: Fri, 23 Jan 2015 13:23:53 -0500
Subject: [PATCH] Disabling subsystem on selftest failure.

The SelfTestSubsystem has been modified such that if the selftest
fails it will invoke the pki-server CLI to undeploy and disable the
failing subsystem. The Tomcat instance and other subsystems not
depending on this subsystem will continue to run. Once the problem
is fixed, the admin can enable the subsystem again with the
pki-server CLI.

https://fedorahosted.org/pki/ticket/745
---
 .../netscape/cmscore/selftests/SelfTestSubsystem.java | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java b/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java
index c44476dd6875072084d9cf1eb267b67883080ae9..2a2cf8b2c907e6cb540893efc2857b888c92f382 100644
--- a/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java
+++ b/base/server/cmscore/src/com/netscape/cmscore/selftests/SelfTestSubsystem.java
@@ -885,6 +885,25 @@ public class SelfTestSubsystem
                             // shutdown the system gracefully
                             CMS.shutdown();
 
+                            IConfigStore cs = CMS.getConfigStore();
+                            String instanceID = cs.get("instanceId");
+                            String subsystemID = cs.get("cs.type").toLowerCase();
+
+                            System.out.println("SelfTestSubsystem: Disabling \"" + subsystemID + "\" subsystem due to selftest failure.");
+
+                            try {
+                                ProcessBuilder pb = new ProcessBuilder("pki-server", "subsystem-disable", "-i", instanceID, subsystemID);
+                                Process process = pb.inheritIO().start();
+                                int rc = process.waitFor();
+
+                                if (rc != 0) {
+                                    System.out.println("SelfTestSubsystem: Unable to disable \"" + subsystemID + "\". RC: " + rc);
+                                }
+
+                            } catch (Exception e2) {
+                                e.printStackTrace();
+                            }
+
                             return;
                         }
                     }
-- 
1.8.4.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]