Bug 1645429

Summary: pkispawn fails due to name collision with /var/log/pki/<instance> [rhel-7.6.z]
Product: Red Hat Enterprise Linux 7 Reporter: Oneata Mircea Teodor <toneata>
Component: pki-coreAssignee: Dinesh Prasanth <dmoluguw>
Status: CLOSED ERRATA QA Contact: Asha Akkiangady <aakkiang>
Severity: high Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: high    
Version: 7.7CC: cpelland, dmoluguw, dpunia, mharmsen, msauton
Target Milestone: rcKeywords: TestCaseProvided, ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: pki-core-10.5.9-8.el7_6 Doc Type: Enhancement
Doc Text:
Previously, the pkispawn utility reported a name collision error when installing a Certificate System subsystem on a server with an existing Certificate System log directory structure. With this enhancement, Certificate System reuses the existing log directory structure to preserve logs of previous installations.
Story Points: ---
Clone Of: 1644769 Environment:
Last Closed: 2019-01-29 17:21: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:
Embargoed:
Bug Depends On: 1644769    
Bug Blocks:    

Description Oneata Mircea Teodor 2018-11-02 08:35:02 UTC
This bug has been copied from bug #1644769 and has been proposed to be backported to 7.6 z-stream (EUS).

Comment 2 Matthew Harmsen 2018-11-02 15:15:14 UTC
Test Procedure

* https://bugzilla.redhat.com/show_bug.cgi?id=1644769#c3

Comment 3 Matthew Harmsen 2018-11-30 00:31:43 UTC
commit 24405fac463e59250ccf42507bba7fb811e3a2fb
Author: Dinesh Prasanth M K <dmoluguw>
Date:   Thu Nov 1 17:02:03 2018 -0400

    Reuse same instance log dirs (if exists)
    
    Resolves: Bug 1644769
    Ticket: https://pagure.io/dogtagpki/issue/3077
    
    - `pkidestroy` behaviour was chagned to preserve the logs by default.
      When `pkispawn` is run, it throws a name space collision error.
    - This patch reuses the log dir and appends logs to the same log dir
      structure (if exists) and logs it accordingly.
    
    `Signed-off-by: Dinesh Prasanth M K <dmoluguw>`
    
    (cherry picked from commit c6c6757b4c566d10d25fe220fa9f59539c7a55ee)

Comment 4 Matthew Harmsen 2018-11-30 00:33:14 UTC
(In reply to Matthew Harmsen from comment #3)
> commit 24405fac463e59250ccf42507bba7fb811e3a2fb
> Author: Dinesh Prasanth M K <dmoluguw>
> Date:   Thu Nov 1 17:02:03 2018 -0400
> 
>     Reuse same instance log dirs (if exists)
>     
>     Resolves: Bug 1644769
>     Ticket: https://pagure.io/dogtagpki/issue/3077
>     
>     - `pkidestroy` behaviour was chagned to preserve the logs by default.
>       When `pkispawn` is run, it throws a name space collision error.
>     - This patch reuses the log dir and appends logs to the same log dir
>       structure (if exists) and logs it accordingly.
>     
>     `Signed-off-by: Dinesh Prasanth M K <dmoluguw>`
>     
>     (cherry picked from commit c6c6757b4c566d10d25fe220fa9f59539c7a55ee)

Cherry-picked to DOGTAG_10_5_9_RHEL_BRANCH

Comment 6 Deepak Punia 2018-12-14 11:39:10 UTC
#module list
OS - RHEL7.6Zupdate2
pki version 10.5.9-7.el7_6

1> pkispawn -s CA -f ca.inf -vv
2> ls /var/log/pki/
	drwxrwx---. 3 pkiuser pkiuser  187 Dec 14 06:18 rhcs93-TMS-CA
	-rw-rw----. 1 pkiuser pkiuser 175K Dec 14 06:18 pki-ca-spawn.20181214061802.log
3> pkidestroy -s CA -i rhcs93-TMS-CA
4> [root@cloud-qe-05 ~]# ls -rlth /var/log/pki/
	-rw-rw----. 1 pkiuser pkiuser 175K Dec 14 06:18 pki-ca-spawn.20181214061802.log
	-rw-rw----. 1 pkiuser pkiuser  31K Dec 14 06:30 pki-ca-destroy.20181214063012.log
	[root@cloud-qe-05 ~]# 
5> pkispawn -s CA -f ca.inf -vv 
		Successfully installed without any error.
6> [root@cloud-qe-05 ~]# ls -rlth /var/log/pki/
-rw-rw----. 1 pkiuser pkiuser 175K Dec 14 06:18 pki-ca-spawn.20181214061802.log
-rw-rw----. 1 pkiuser pkiuser  31K Dec 14 06:30 pki-ca-destroy.20181214063012.log
drwxrwx---. 3 pkiuser pkiuser  187 Dec 14 06:32 rhcs93-TMS-CA
-rw-rw----. 1 pkiuser pkiuser 175K Dec 14 06:32 pki-ca-spawn.20181214063200.log
-rw-rw-r--. 1 root    root     32K Dec 14 06:33 pki-ca-spawn.20181214063342.log

Comment 10 errata-xmlrpc 2019-01-29 17:21: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.

https://access.redhat.com/errata/RHBA-2019:0168