Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1458010

Summary: add check for registry entry in pkispawn
Product: Red Hat Enterprise Linux 8 Reporter: Matthew Harmsen <mharmsen>
Component: pki-coreAssignee: Ade Lee <alee>
Status: CLOSED WONTFIX QA Contact: Asha Akkiangady <aakkiang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: ascheel, dmoluguw, mharmsen, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-10 14:11:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Harmsen 2017-06-01 18:46:34 UTC
This bug is created as a clone of upstream ticket:
https://pagure.io/dogtagpki/issue/2712

This resulted froma conversation with a community member who had run into this issue.

Specifically, the community member has attempted to run pkispawn again after an incomplete pkidestroy.  The instance directory did not yet exist,  but the registry entry under /etc/sysconfig/pki did.

As a result, when trying to create the master dictionary, we call :

compose_pki_master_dictionary , which calls instance.load(), which amongst other things, checks to see if the registry entry exists, and if so, tries to load the CS.cfg for that instance.

Of course at that point, the CS.cfg does not exist yet, and the installer bombs.

File "/usr/sbin/pkispawn", line 820, in <module>
     main(sys.argv)
File "/usr/sbin/pkispawn", line 502, in main
    create_master_dictionary(parser)
 File "/usr/sbin/pkispawn", line 644, in create_master_dictionary      
    parser.compose_pki_master_dictionary()
 File "/usr/lib/python2.7/dist-packages/pki/server/deployment/pkiparser.py", line 615, in compose_pki_master_dictionary
     instance.load()
File "/usr/lib/python2.7/dist-packages/pki/server/__init__.py", line 595, in load
     subsystem.load()
File "/usr/lib/python2.7/dist-packages/pki/server/__init__.py", line 129, in load
    lines = open(self.cs_conf).read().splitlines()
IOError: [Errno 2] No such file or directory: '/var/lib/pki/pki-tomcat/ca/conf/CS.cfg'

This is somewhat confusing.  One way to fix this would be to check for the registry entry before all this happens.  We do check for the existence of the top level instance directory beforehand in the main() function in pkispawn.  We could add a check for the registry entry too.

Another would be to refactor the load() function to not read the CS.cfg in this case.

Comment 2 Matthew Harmsen 2017-06-02 20:37:54 UTC
After discussions with vakwetu and edewata, moving to 7.5.

Comment 3 Matthew Harmsen 2017-10-25 18:12:11 UTC
[20171025] - RHEL 7.5 pre-Alpha Offline Triage ==> 7.6

Comment 4 Matthew Harmsen 2018-04-24 01:12:13 UTC
Per RHEL 7.5.z/7.6/8.0 Triage:  7.6

alee: we've seen this in cases of incomplete install/renewal.  fixing this will help in failed installs/cleanups.

Comment 5 Matthew Harmsen 2018-07-03 23:33:16 UTC
Moved to RHEL 7.7.

Comment 7 Dinesh Prasanth 2018-11-13 15:55:21 UTC
After discussions with vakwetu, a more explicit check would provide a better user-friendly error message. The error message could explain the use of pkidestroy with --force option.