Bug 690626 - pkiremove removes the registry entry for all instances on a machine
Summary: pkiremove removes the registry entry for all instances on a machine
Keywords:
Status: CLOSED EOL
Alias: None
Product: Dogtag Certificate System
Classification: Retired
Component: Installer (pkicreate/pkiremove)
Version: 9.0
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: RHCS Maintainers
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks: 691076
TreeView+ depends on / blocked
 
Reported: 2011-03-24 20:24 UTC by Ade Lee
Modified: 2020-03-27 20:00 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 691076 (view as bug list)
Environment:
Last Closed: 2020-03-27 20:00:07 UTC


Attachments (Terms of Use)
preserve pki registry directory during uninstall (592 bytes, patch)
2011-03-25 21:42 UTC, John Dennis
alee: review+
Details | Diff

Description Ade Lee 2011-03-24 20:24:16 UTC
Description of problem:

This problem manifests itself if there is more than one instance of a subsystem on a machine.  When pkiremove is executed, it removes the registry directory /etc/sysconfig/pki/<subsystem_type> rather than the registry entry for that specific instance. (/etc/sysconfig/pki/<type>/foo).

My guess is that its going through its installation manifest and sees that it created the directory - and then blows it away.

The problem of course, is that any other instances of the same type then lose their own entries and become inoperable.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Install two instances of a CA using pkicreate
2. Remove one instance using pkicreate (maybe the first instance created).
3. All other instances of the same type become inoperable. 
  
Actual results:


Expected results:

Only the registry entries for the instance being removed should be removed.  If no other instances exist, then the top level can safely be removed.


Additional info:

Comment 1 John Dennis 2011-03-24 21:24:14 UTC
This should be an easy fix, when you create an file or directory in pkicreate you can specify it's uninstall action, by default it's 'remove' but you can set it to 'preserve'. So all I think we need to do is set the uninstall action for /etc/sysconfig/pki/<subsystem_type> to 'preserve'.

Maybe there should be an uninstall action called 'preserve_unless_empty' so we don't leave empty directories around.

Comment 2 John Dennis 2011-03-25 21:42:17 UTC
Created attachment 487683 [details]
preserve pki registry directory during uninstall

The fix in the patch prevents /etc/sysconfig/<subsystem> from being nuked even if it wasn't empty.

However, if /etc/sysconfig and it's children are empty the directories are still removed because of this code in pkiremove. I'm pretty sure this is the desired behaviour.

    # Establish PKI subsystem-level registry
    $pki_registry_subsystem_path = "$pki_registry_path/$subsystem_type";

    # If empty, remove the PKI subsystem-level registry
    if (directory_exists($pki_registry_subsystem_path)) {
        if (is_directory_empty($pki_registry_subsystem_path)) {
            remove_directory($pki_registry_subsystem_path);
        }
    }

    # If empty, remove the PKI-level registry
    if (directory_exists($pki_registry_path)) {
        if (is_directory_empty($pki_registry_path)) {
            remove_directory($pki_registry_path);
        }
    }

Comment 3 John Dennis 2011-03-25 22:03:14 UTC
Oh BTW, I did test the various scenarios, each does what is expected.

Comment 4 John Dennis 2011-03-28 17:37:47 UTC
Fixed and committed.

Sending        base/setup/pkicreate
Transmitting file data .
Committed revision 1933.


Note You need to log in before you can comment on or make changes to this bug.