Bug 855146

Summary: [cli] applying a promotion to delete a package from an environment appears to work but doesn't actually seem to do it.
Product: Red Hat Satellite Reporter: Corey Welton <cwelton>
Component: HammerAssignee: Mike McCune <mmccune>
Status: CLOSED WONTFIX QA Contact: Corey Welton <cwelton>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: bkearney, inecas, omaciel, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-04 15:18:42 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:
Attachments:
Description Flags
screenshot none

Description Corey Welton 2012-09-06 19:41:49 UTC
Description of problem:
When I try to do a promotion which deletes content from an environment, the cli progress indicator suggests that it is done, but i see no indication that it actually works.

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


How reproducible:


Steps to Reproduce:
1. Create an org 'Test_Org_1346859138' and an environment within this org, 'Dev'
2.  Create a provider/product/repo and sync. For this, I used google chrome:
http://dl.google.com/linux/chrome/rpm/stable/x86_64
3.  Create a changeset and promote this content to Dev. 
4. In the webui, navigate to Content > Changeset Management > Changesets > Dev >  Products > $product > Packages and assure your package(s) appear.

5. Attempt to create a new changeset to delete one of these packages:
  # katello --user admin --password admin changeset create --deletion  --org Test_Org_1346859138 --environment Dev --name deltestd
  # katello --user admin --password admin changeset update --from_product "Google Products_product"  --add_package google-chrome-unstable-23.0.1255.0-154716.x86_64 --org Test_Org_1346859138 --name deltestd --environment Dev
  # katello --user admin --password admin changeset apply --org Test_Org_1346859138 --name deltestd --environment Dev

6. Navigate back to the location in step 4, only this time checking to assure your package has been deleted.
  
Actual results:
CLI: Applying the changeset, please wait... [\]
WebUI: package still exists.


[root@se-rhelbox Google_Products_repo_0]# ls -Al
total 20
drwxr-xr-x. 2 apache apache 4096 Sep  5 14:44 drpms
lrwxrwxrwx. 1 apache apache  163 Sep  5 14:44 google-chrome-beta-22.0.1229.26-153823.x86_64.rpm -> ../../../../../../packages/google-chrome-beta/22.0.1229.26/153823/x86_64/599e685c1c9ba6bb01564b0a250d9cbc88be291f/google-chrome-beta-22.0.1229.26-153823.x86_64.rpm
lrwxrwxrwx. 1 apache apache  167 Sep  5 14:44 google-chrome-stable-21.0.1180.89-154005.x86_64.rpm -> ../../../../../../packages/google-chrome-stable/21.0.1180.89/154005/x86_64/98b008ad01358c9b17ab5e6ef0ea348631f2cdda/google-chrome-stable-21.0.1180.89-154005.x86_64.rpm
lrwxrwxrwx. 1 apache apache  169 Sep  5 14:44 google-chrome-unstable-23.0.1255.0-154716.x86_64.rpm -> ../../../../../../packages/google-chrome-unstable/23.0.1255.0/154716/x86_64/93ab0208b8bcba74bbdceddfe1f9b88399aaf642/google-chrome-unstable-23.0.1255.0-154716.x86_64.rpm
drwxr-xr-x. 2 apache apache 4096 Sep  5 11:18 repodata

Nothing out of the ordinary shows up in delayed job log(s)

Expected results:
package gets deleted.

Additional info:
Katello Version: 1.1.9-1.git.95.0ed1e6f.el6

Comment 1 Pavel Pokorny 2012-09-07 08:36:41 UTC
I added katello-foreman product/repo [1], synced, created two deletion changesets for:

foreman-console-1.0.0-14.1648bec.fc17 (without the .noarch)
foreman-cli-1.0.0-14.1648bec.fc17.noarch

Applied one by one and both packages was removed. I also tried to create deletion changeset from UI, works too.

[1] http://koji-katello.lab.eng.brq.redhat.com/releases/yum/katello-foreman/Fedora/17/x86_64/

Katello Version: 1.1.9-1.git.95.0ed1e6f.el6

Comment 2 Corey Welton 2012-09-07 13:29:46 UTC
Confirmed this with a package from a separate Provider/Product/Repo.

It should be noted, however, that attempting to remove a product via the CLI appears to work fine.  Individual package are what seem to be failing.


Provider: Virtualbox
Product: VBox
Repo: Fedora 17 - x86_64
* URL: http://download.virtualbox.org/virtualbox/rpm/fedora/17/x86_64/

(Note: Above content has been previously synced and promoted to environment Dev)

katello --user admin --password admin changeset create --deletion  --org Test_Org_1346859138 --environment Dev --name vboxcreate_delpackage

katello --user admin --password admin changeset update  --from_product VBox --add_package VirtualBox-4.2-4.2.0_RC3_80444_fedora17-1.x86_64  --org Test_Org_1346859138 --name vboxcreate_delpackage --environment Dev

katello --user admin --password admin changeset apply  --org Test_Org_1346859138 --name vboxcreate_delpackage --environment Dev

Comment 3 Corey Welton 2012-09-07 13:32:02 UTC
Created attachment 610716 [details]
screenshot

screenshot of UI, refreshed, after attempting package delete via CLI

Comment 4 Pavel Pokorny 2012-09-11 12:08:35 UTC
Reproduced at last.

> tuple
=> [[["VirtualBox-4.2-4.2.0_RC3_80444_fedora17-1.x86_64.rpm", "9312a04f345c370acf84755c2b592a120a3f4a8c"], ["ACME_Corporation-Dev-VBox-Fedora_17_-_x86_64"]]]
> Resources::Pulp::Repository.delete_repo_packages(tuple)
=> "{\"VirtualBox-4.2-4.2.0_RC3_80444_fedora17-1.x86_64.rpm\": {\"9312a04f345c370acf84755c2b592a120a3f4a8c\": [[\"ACME_Corporation-Dev-VBox-Fedora_17_-_x86_64\"]]}}"
 
pulp.log:
2012-09-11 14:01:47,712 4922:140321763600128: pulp.server.api.repo:ERROR: repo:2192 Unable to find package id for filename=VirtualBox-4.2-4.2.0_RC3_80444_fedora17-1.x86_64.rpm, checksum=9312a04f345c370acf84755c2b592a120a3f4a8c
 

pulp-admin package info --name VirtualBox-4.2 --repoid ACME_Corporation-Dev-VBox-Fedora_17_-_x86_64

One of listed packages is:
 
Id fb8bdd22-4c23-46e6-99e8-ecf5049d3952
Name VirtualBox-4.2
Description VirtualBox is a powerful PC virtualization solution allowing
you to run a wide range of PC operating systems on your Linux
system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD
and others. VirtualBox comes with a broad feature set and
excellent performance, making it the premier virtualization
software solution on the market.
Arch x86_64
Version 4.2.0_RC3_80444_fedora17
Release 1
Epoch 0
Checksum {u'sha': u'9312a04f345c370acf84755c2b592a120a3f4a8c'}
Filename VirtualBox-4.2-4.2.0_RC3_80444_fedora17-1.x86_64.rpm
Size 66573709
Repo_defined True
Download_url https://katello.rhel//pulp/repos/ACME_Corporation/Library/custom/VBox/Fedora_17_-_x86_64/VirtualBox-4.2-4.2.0_RC3_80444_fedora17-1.x86_64.rpm
Buildhost tinderlin.de.oracle.com
Group Applications/System
License GPLv2
Vendor Oracle Corporation

Still don't know where is the problem.

Comment 5 Ivan Necas 2012-09-11 15:31:14 UTC
I was able to remove the camel-0.1-1.noarch package from our zoo repo, seems like some issue with naming, maybe the dashes cause the problem

Comment 6 Ivan Necas 2012-09-11 16:13:11 UTC
I've tried it with VirtualBox-4.1-4.1.16_78094_fedora17-1.x86_64.rpm  as well and it worked. Interesting fact: the syncing of the VBOX repo failed with message 'Failure when receiving data from the peer' in grinder.log)

Corey:

Would it possible to provide katello-debug output form the machine for further analysis?

Comment 7 Mike McCune 2012-09-12 04:03:07 UTC
I tried removing:

* some-package-lots-of-hashes-1.0.1-1.elfake.noarch.rpm
* packagewith.dot-1.6.4-1.elfake.noarch.rpm
* some.package.with.dots-2.1.4-1.elfake.noarch.rpm,

it worked fine, so I concluded it wasn't based on name.

I dug into the pulp code and found it searching mongo based on:

 found = p_col.find_one({"filename":filename, "checksum.sha256":checksum}, {"id":1})

I then dug and looked in mongo for the virtualbox RPMs and found the sha field is stored as:

 { "sha" : "9312a04f345c370acf84755c2b592a120a3f4a8c" }

so the above python code in Pulp will never find the virtualbox RPMs.  This means we would need to patch Pulp to search for either sha or sha256 RPMs.

I'll get a bug over to the Pulp team to take a look

Comment 8 Mike McCune 2012-09-12 04:05:12 UTC
forgot to add, the other RPMs that are synced and will delete fine are hashed with sha256:

 "checksum" : { "sha256" : "7d4665913aa5045bc393cf47002c462c8df42c645033acfca3cb05abadf5048c" }

Comment 9 Hayk Hovsepyan 2012-09-14 14:19:56 UTC
Have the same problem with "google-chrome" package.
But it worked for "zoo" packages.

Comment 11 Sachin Ghai 2012-10-05 08:02:06 UTC
I found the same issue with google chrome packages. However with other repos, it worked perfectly. 

I removed the package via cli and changeset applied successfully. but package still exists in webUI in 'dev' env.

katello> changeset create --name remove_pkg --org ACME_Corporation --deletion --environment dev
Successfully created changeset [ remove_pkg ] for environment [ dev ]

katello> changeset update --from_product "google" --add_package "google-chrome-stable" --name remove_pkg --org ACME_Corporation --env dev
Successfully updated changeset [ remove_pkg ]

katello> changeset apply --name remove_pkg --org ACME_Corporation --env dev
Changeset [ remove_pkg ] applied

Comment 12 Bryan Kearney 2014-09-04 15:18:42 UTC
Spoke with Corey, and this bug is no longer relevant. I am closing it out.