pki-bot / pki-issues-final

0 stars 0 forks source link

Cli:Self test failure exception handling improvement #2280

Open pki-bot opened 3 years ago

pki-bot commented 3 years ago

This issue was migrated from Pagure Issue #2731. Originally filed by mharmsen (@mharmsen) on 2017-06-08 18:56:53:


This bug is raised so as to improve failures while selftest is happened for subsystems so that cli can handle it gracefully.

Test case 1 :

If a selftestID doesn't exist, so still it gives the status.Ideally it should exit with not a valid id.

[root@pki1 test_dir]# pki -p 25080 -d /opt/rhqa_pki/certdb/ -c Secret123 -n "TPS_AdminV" tps-selftest-show testing

SelfTest "testing"

SelfTest ID: testing Enabled at startup: false Enabled on demand: false

Test Case 2:

In case self test is failed to run,It gives NPE in debug logs.

Steps to reproduce:

  1. In CS.cfg of any substem make one of the "selftest id" unavailable by commenting them.In that case selftest will not run. For example here for ocsp i have done below changes in CS.cfg.

selftests.container.instance.OCSPPresence=com.netscape.cms.selftests.ocsp.OCSP

Presence

selftests.container.order.onDemand=OCSPPresence:critical,

SystemCertsVerification:critical, OCSPValidity:critical

selftests.container.order.startup=OCSPPresence:critical,

SystemCertsVerification:critical

selftests.plugin.OCSPPresence.OcspSubId=ocsp

  1. Make sure correct failure message is printed with correct exception.
  2. pki -p 22080 -d /opt/rhqa_pki/certdb/ -c Secret123 -n "OCSP_AdminR" ocsp-selftest-run PKIException: null
[06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor: SelfTestResource.runSelfTests() [06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor: content-type: null [06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor: accept: [application/xml] [06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor: response format: application/xml [06/Jun/2017:11:08:15][http-bio-22443-exec-9]: SelfTestService.runSelfTests() java.lang.NullPointerException at org.dogtagpki.server.rest.SelfTestService.runSelfTests(SelfTestServi ce.java:188) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Additional info:

Complete failure logs:
[06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor:
SelfTestResource.runSelfTests()
[06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor:
content-type: null
[06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor:
accept: [application/xml]
[06/Jun/2017:11:08:15][http-bio-22443-exec-9]: MessageFormatInterceptor:
response format: application/xml
[06/Jun/2017:11:08:15][http-bio-22443-exec-9]: SelfTestService.runSelfTests()
java.lang.NullPointerException
        at org.dogtagpki.server.rest.SelfTestService.runSelfTests(SelfTestServi
ce.java:188)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
ssorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(Resourc
eMethodInvoker.java:280)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodI
nvoker.java:234)
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodI
nvoker.java:221)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDisp
atcher.java:356)
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDisp
atcher.java:179)
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher
.service(ServletContainerDispatcher.java:220)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.serv
ice(HttpServletDispatcher.java:56)
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.serv
ice(HttpServletDispatcher.java:51)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
ssorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:288)
        at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:285)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
        at
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:320)
        at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:175)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
licationFilterChain.java:297)
        at org.apache.catalina.core.ApplicationFilterChain.access$000(Applicati
onFilterChain.java:55)
        at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFil
terChain.java:191)
        at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFil
terChain.java:187)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
FilterChain.java:186)
        at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
ssorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:288)
        at
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:285)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.security.auth.Subject.doAsPrivileged(Subject.java:549)
        at
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:320)
        at
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:260)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(App
licationFilterChain.java:237)
        at org.apache.catalina.core.ApplicationFilterChain.access$000(Applicati
onFilterChain.java:55)
        at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFil
terChain.java:191)
        at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFil
terChain.java:187)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(Application
FilterChain.java:186)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapper
Valve.java:218)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContext
Valve.java:110)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentic
atorBase.java:615)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVa
lve.java:116)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHtt
p11Processor.java:1087)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoi
nt.java:316)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskT
hread.java:61)
        at java.lang.Thread.run(Thread.java:748)
[06/Jun/2017:11:08:15][http-bio-22443-exec-9]: SignedAuditEventFactory:
create() message created for eventType=ACCESS_SESSION_TERMINATED
pki-bot commented 3 years ago

Comment from mharmsen (@mharmsen) at 2017-06-08 18:57:46

Metadata Update from @mharmsen:

pki-bot commented 3 years ago

Comment from mharmsen (@mharmsen) at 2017-06-08 19:00:54

Per PKI Bug Council of 06/08/2017 - CLI for selftests is not yet supported - 10.5

pki-bot commented 3 years ago

Comment from mharmsen (@mharmsen) at 2017-08-31 02:02:42

Metadata Update from @mharmsen:

pki-bot commented 3 years ago

Comment from mharmsen (@mharmsen) at 2018-05-02 18:34:12

Per 10.5.x/10.6 Triage: FUTURE

alee: usability issue. should not be too hard to fix.