Bug 855146 - [cli] applying a promotion to delete a package from an environment appears to work but doesn't actually seem to do it.
[cli] applying a promotion to delete a package from an environment appears to...
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Hammer (Show other bugs)
Unspecified Unspecified
unspecified Severity high (vote)
: Unspecified
: --
Assigned To: Mike McCune
Corey Welton
: Triaged
Depends On:
  Show dependency treegraph
Reported: 2012-09-06 15:41 EDT by Corey Welton
Modified: 2014-09-04 11:18 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-09-04 11:18:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
screenshot (21.87 KB, image/png)
2012-09-07 09:32 EDT, Corey Welton
no flags Details

  None (edit)
Description Corey Welton 2012-09-06 15:41:49 EDT
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:
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 04:36:41 EDT
I added katello-foreman product/repo [1], synced, created two deletion changesets for:

foreman-console-1.0.0-14.1648bec.fc17 (without the .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 09:29:46 EDT
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 09:32:02 EDT
Created attachment 610716 [details]

screenshot of UI, refreshed, after attempting package delete via CLI
Comment 4 Pavel Pokorny 2012-09-11 08:08:35 EDT
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\"]]}}"
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 11:31:14 EDT
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 12:13:11 EDT
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)


Would it possible to provide katello-debug output form the machine for further analysis?
Comment 7 Mike McCune 2012-09-12 00:03:07 EDT
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 00:05:12 EDT
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 10:19:56 EDT
Have the same problem with "google-chrome" package.
But it worked for "zoo" packages.
Comment 11 Sachin Ghai 2012-10-05 04:02:06 EDT
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 11:18:42 EDT
Spoke with Corey, and this bug is no longer relevant. I am closing it out.

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