Bug 887353

Summary: [Cartridge] Removing a cartridge leaves its info directory in place
Product: OpenShift Container Platform Reporter: Luke Meyer <lmeyer>
Component: ContainersAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 1.0.1CC: jialiu, juwu, libra-onpremise-devel, mmasters, xjia
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Uninstalling a cartridge left the /info directory uncleaned, and caused the library to list removed cartridges as available. This update adds the relevant directory info to %files stanza so the RPM recognizes the directories as belonging to the cartridge and removes them cleanly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-28 19:08:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Luke Meyer 2012-12-14 18:47:47 UTC
Description of problem:
For a number of cartridges, if the cartridge is installed and then removed, it leaves behind the /info directory it installed. All should uninstall cleanly. Because it doesn't, the facter believes the cartridge is still there, and the broker lists it as an option, but of course trying to create a gear with the cartridge won't work.

Version-Release number of selected component (if applicable):
openshift-origin-cartridge-ruby-1.9-scl-1.0.3-1.el6op.noarch is one example. Not all have this problem (e.g. postgres), but most do.

Steps to Reproduce:
1. Install a node with the ruby-1.9 cartridge
2. Yum uninstall openshift-origin-cartridge-ruby-1.9-scl
3. ls /usr/libexec/openshift/cartridges/ruby-1.9/
  
Actual results:
"info" directory is there

Expected results:
Directory shouldn't exist at all after removal.

Additional info:
Low priority just because, who wants to remove cartridges?
Packaging problem.

Comment 2 Miciah Dashiel Butler Masters 2013-01-22 18:10:18 UTC
Here's a patch: <https://github.com/openshift/enterprise-server/pull/29>.  Does it look OK?

We could make this change upstream, in origin-server.  However, the set of cartridges in enterprise-server that need the fix is not a subset of the set of cartridges in origin-server that need the fix, and vice versa: origin-server already has fixed diy and cron cartridges, and it has an additional cartridge for switchyard that enterprise-server does not have.

Here's a pull request against origin-server with the fix for the cartridges that need it: <https://github.com/openshift/origin-server/pull/1194>.  Should we try to get the change merged into origin-server and then pull that into enterprise-server?

Comment 4 Luke Meyer 2013-01-22 20:59:56 UTC
Awesome, thanks for working on this.

I haven't looked at the patch, I assume it's fine. But I see no reason to wait on the upstream to merge in order to pull into enterprise-server. They're conceptually the same change even if the details differ by cartridge list.

It might be worth a cloned bug to ensure the fix works in both places. Leave that up to QE to decide?

Comment 5 Brenton Leanhardt 2013-01-23 06:20:08 UTC
I don't think upstream has a requirement that every commit be attached to a BZ so for something this minor I'm personally OK with someone just fixing it upstream and moving on since this looks so simple.  It makes sense for us to have a BZ because this is where it was noticed.

In the future if an upstream patch is non-trivial then it would be a good idea to create a BZ.  That way we can ensure it's tested so that we don't regress anything when we rebase.

Comment 6 openshift-github-bot 2013-01-29 19:31:01 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/7ba8e10e3e7768ebd277be9c77fd28ac17ad3370
Bug 887353: removing a cartridge leaves info/ dir

This commit adds each cartridge's %{cartridgedir}/ directory as well as its
%{cartridgedir}/info/ directory to the %files stanza of the cartridge so
that RPM recognises these directories as belonging to the cartridge and
removes them when the RPMs are removed.

Following the example of the python-2.6 cartridge, which already has these
directories in its %files stanza, this commit uses %dir for the
%{cartridgedir}/ and %{cartridgedir}/info/.  We do need the default
permissions (0755) on these two directories so that the MCollective agent
can read the info/ directory.

This commit fixes Bug 887353.

Comment 9 xjia 2013-01-31 05:10:29 UTC
Version:
http://buildvm-devops.usersys.redhat.com/puddle/build/OpenShiftEnterprise/1.1.x/2013-01-29.1/

Verify:
[root@node ~]# yum remove openshift-origin-cartridge-ruby-1.9-scl
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity

This machine has not been registered and therefore has
no access to security and other critical updates. Please
register using subscription-manager.

Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package openshift-origin-cartridge-ruby-1.9-scl.noarch 0:1.0.8-1.el6op will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================
 Package                                                      Arch                        Version                             Repository                            Size
=========================================================================================================================================================================
Removing:
 openshift-origin-cartridge-ruby-1.9-scl                      noarch                      1.0.8-1.el6op                       @openshift_node                       64 k

Transaction Summary
=========================================================================================================================================================================
Remove        1 Package(s)

Installed size: 64 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : openshift-origin-cartridge-ruby-1.9-scl-1.0.8-1.el6op.noarch                                                                                          1/1 
Installed products updated.
  Verifying  : openshift-origin-cartridge-ruby-1.9-scl-1.0.8-1.el6op.noarch                                                                                          1/1 

Removed:
  openshift-origin-cartridge-ruby-1.9-scl.noarch 0:1.0.8-1.el6op                                                                                                         

Complete!
[root@node ~]# ls /usr/libexec/openshift/cartridges/ruby-1.9
ls: cannot access /usr/libexec/openshift/cartridges/ruby-1.9: No such file or directory

Comment 11 errata-xmlrpc 2013-02-28 19:08:33 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.

http://rhn.redhat.com/errata/RHSA-2013-0582.html