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

Fraser Tweedale ftweedal at redhat.com
Tue Jan 27 07:09:44 UTC 2015


On Sun, Jan 25, 2015 at 09:19:57PM -0600, Endi Sukma Dewata wrote:
> 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

ACK.

I tested it by hardcoding an ESelfTestException in one of the tests.
Behaved as expected, but in selftests.log is says:

    SelfTestSubsystem: The CRITICAL self test plugin called selftests.container.instance.CAPresence running at startup FAILED!
    SelfTestSubsystem: All CRITICAL self test plugins ran SUCCESSFULLY at startup!

Not sure if this is intended behaviour - it is possibly intended,
but if so it is quite confusing.  But I don't think your patch
causes this.

Cheers,
Fraser

> From c5c32691b4eb6441dc997d215ba69bfb5610595b Mon Sep 17 00:00:00 2001
> From: "Endi S. Dewata" <edewata at 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
> 

> _______________________________________________
> Pki-devel mailing list
> Pki-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/pki-devel




More information about the Pki-devel mailing list