Bug 1446364

Summary: pkispawn returns before tomcat is ready
Product: Red Hat Enterprise Linux 7 Reporter: Matthew Harmsen <mharmsen>
Component: pki-coreAssignee: Christian Heimes <cheimes>
Status: CLOSED ERRATA QA Contact: Asha Akkiangady <aakkiang>
Severity: unspecified Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: unspecified    
Version: 7.4CC: akahat, arubin, mharmsen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: pki-core-10.4.1-4.el7 Doc Type: Bug Fix
Doc Text:
Subsequent PKI installation no longer fails Previously, when installing multiple public key infrastructure (PKI) instances in batch mode, the installation script did not wait until the CA instance was restarted. As a consequence, the installation of subsequent PKI instances could fail. The script has been updated and now waits until the new subsystem is ready to handle requests before it continues.
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 22:50:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Matthew Harmsen 2017-04-27 18:23:47 UTC
This bug is created as a clone of upstream ticket:

While I was working on Travis CI tests, I noticed that ```pkispawn -s KRA``` was failing regularly. It looks like ```pkispawn -s CA``` returns before the tomcat instance is ready to serve requests. Travis CI spawn a KRA directly after CA with no delay. Tests are now using a polling loop with curl and sleep. It usually takes 2 to 3 seconds until ```curl http://localhost:8080``` works.

## errors
$ pkispawn -f /tmp/workdir/pki/.travis/pki.cfg -s KRA
Log file: /var/log/pki/pki-kra-spawn.20170418062853.log
Loading deployment configuration from /tmp/workdir/pki/.travis/pki.cfg.
ERROR:  Unable to access security domain: HTTPSConnectionPool(host='pki.test', port=8443): Max retries exceeded with url: /ca/rest/securityDomain/domainInfo (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7f05cedb3210>: Failed to establish a new connection: [Errno 111] Connection refused',))

## suggested solution

pkispawn should use ```wait_for_startup``` to wait until Tomcat is ready before it exits.

Comment 2 Matthew Harmsen 2017-05-08 18:14:58 UTC
cheimes made the following check-in:

commit c0bb0ee8e36a85673e30352a7205414b215196a5
Author: Christian Heimes <cheimes>
Date:   Mon May 8 18:53:26 2017 +0200

    pkispawn: wait after final restart
    The finalization scriptlet now waits after service has been restarted.
    Change-Id: Id462728386b9d7e6b3364e1651ef6676115dd1de
    Bugzilla: BZ#1446364
    Pagure: 2644
    Signed-off-by: Christian Heimes <cheimes>

Comment 4 Amol K 2017-06-15 13:23:16 UTC
I tested this bug on pki 10.4.1-8.el7 version. 

I did not encounter any problem like "Connection failed".

Verifying this bug.

Comment 6 errata-xmlrpc 2017-08-01 22:50:57 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.