Bug 1645262

Summary: pkidestroy may not remove all files [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.4CC: dmoluguw, edewata, mharmsen, msauton, sumenon
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, Certificate System removed all corresponding logs when you uninstalled subsystems. With this update, by default, the pkidestroy utility no longer removes the logs. To remove the logs when you uninstall a subsystem, pass the new --remove-logs parameter to pkidestroy. Additionally, this update adds the --force parameter to pkidestroy. Previously, an incomplete installation left some files and directories, which prevented a complete uninstallation of a Certificate System instance. Pass --force to pkidestroy to completely remove a subsystem and all corresponding files of an instance.
Story Points: ---
Clone Of: 1372056 Environment:
Last Closed: 2019-01-29 17:21:55 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: 1372056    
Bug Blocks:    
Attachments:
Description Flags
Uninstall Log file none

Description Oneata Mircea Teodor 2018-11-01 18:42:10 UTC
This bug has been copied from bug #1372056 and has been proposed to be backported to 7.6 z-stream (EUS).

Comment 3 Matthew Harmsen 2018-11-30 00:20:21 UTC
commit 7f0af3958605c9826c5bb71fcb43cfccb3056d90
Author: Dinesh Prasanth M K <dmoluguw>
Date:   Thu Nov 1 16:43:36 2018 -0400

    Add --remove-logs flag to pki-destroy
    
    Partially resolves: Bug 1372056
    
    List of changes by this commit:
    
    - Logs are preserved by default (comment #1 in BZ)
    - Add `--remove-flags` flag to pkidestroy to remove logs
    
    Signed-off-by: Dinesh Prasanth M K <dmoluguw>
    (cherry picked from commit 9e2cdb0b2f5df552ef50ba7883b4c686adec41b3)

commit 9c24a655511c911c8acc724a45f79b3ea4986b9f
Author: Dinesh Prasanth M K <dmoluguw>
Date:   Thu Nov 1 16:29:11 2018 -0400

    Add --force flag to pki-destroy
    
    Resolves: Bug 1372056
    Ticket: https://pagure.io/dogtagpki/issue/1172
    
    List of changes with this commit:
    - Adds new flag `--force` to pkidestroy to force remove a subsystem
    - Use `os.path.join()` instead of appending '/' between path names
    - Remove the `pki_database_path` dir instead of removing contents of the dir
        - This is moved to `security_database.py` instead of `configuration.py`
    - pkidestroy and pkispawn logs are owned by `root` instead of configured pki
    
    Signed-off-by: Dinesh Prasanth M K<dmoluguw>
    (cherry picked from commit 926c26e10db1b3fde8f24802d7a77419d0f2f28d)

Comment 4 Matthew Harmsen 2018-11-30 00:32:47 UTC







(In reply to Matthew Harmsen from comment #3)
> commit 7f0af3958605c9826c5bb71fcb43cfccb3056d90
> Author: Dinesh Prasanth M K <dmoluguw>
> Date:   Thu Nov 1 16:43:36 2018 -0400
> 
>     Add --remove-logs flag to pki-destroy
>     
>     Partially resolves: Bug 1372056
>     
>     List of changes by this commit:
>     
>     - Logs are preserved by default (comment #1 in BZ)
>     - Add `--remove-flags` flag to pkidestroy to remove logs
>     
>     Signed-off-by: Dinesh Prasanth M K <dmoluguw>
>     (cherry picked from commit 9e2cdb0b2f5df552ef50ba7883b4c686adec41b3)
> 
> commit 9c24a655511c911c8acc724a45f79b3ea4986b9f
> Author: Dinesh Prasanth M K <dmoluguw>
> Date:   Thu Nov 1 16:29:11 2018 -0400
> 
>     Add --force flag to pki-destroy
>     
>     Resolves: Bug 1372056
>     Ticket: https://pagure.io/dogtagpki/issue/1172
>     
>     List of changes with this commit:
>     - Adds new flag `--force` to pkidestroy to force remove a subsystem
>     - Use `os.path.join()` instead of appending '/' between path names
>     - Remove the `pki_database_path` dir instead of removing contents of the
> dir
>         - This is moved to `security_database.py` instead of
> `configuration.py`
>     - pkidestroy and pkispawn logs are owned by `root` instead of configured
> pki
>     
>     Signed-off-by: Dinesh Prasanth M K<dmoluguw>
>     (cherry picked from commit 926c26e10db1b3fde8f24802d7a77419d0f2f28d)

Cherry-picked to DOGTAG_10_5_9_RHEL_BRANCH

Comment 6 Sudhir Menon 2018-12-28 13:08:16 UTC
Observations:

1. --remove-logs flag available and working for pki-destroy command
2. --force flag available and working to pki-destroy command
3. Executed the below test scenarios but found that in 3 scenario below, the log file is not removed.

Test Cases:
* https://bugzilla.redhat.com/show_bug.cgi?id=1372056#c8
* https://bugzilla.redhat.com/show_bug.cgi?id=1372056#c9
* https://bugzilla.redhat.com/show_bug.cgi?id=1372056#c10

Attaching the logs for reference.

Comment 7 Sudhir Menon 2018-12-28 13:09:29 UTC
Created attachment 1517199 [details]
Uninstall Log file

Comment 8 Dinesh Prasanth 2019-01-02 19:16:59 UTC
(In reply to Sudhir Menon from comment #7)
> Created attachment 1517199 [details]
> Uninstall Log file

Sudhir, based on your logs attached, for scenario 3:

BEFORE FORCED UNINSTALLATION: 4 directories, 13 files
AFTER FORCED UNINSTALLATION:  0 directories, 2 files

The **pkispawn** and **pkidestroy** logs are *intentionally* stored for sysadmin's reference. The subsystem related logs are to be removed using the --remove-logs option. What you observe is the expected behavior.

Comment 9 Sudhir Menon 2019-01-03 05:41:21 UTC
Dinesh,
Thank you for confirming this behaviour. Marking the bug as VERIFIED.

Tested on RHEL7.6 
[root@master ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.6 (Maipo)

[root@master ~]# rpm -qa | grep pki
pki-server-10.5.9-10.el7_6.noarch
redhat-pki-console-theme-10.5.9-2.el7pki.noarch
redhat-pki-server-theme-10.5.9-2.el7pki.noarch
pki-console-10.5.9-1.el7pki.noarch
pki-kra-10.5.9-10.el7_6.noarch
pki-base-10.5.9-10.el7_6.noarch
pki-ca-10.5.9-10.el7_6.noarch
pki-tools-10.5.9-10.el7_6.x86_64
pki-base-java-10.5.9-10.el7_6.noarch

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