Bug 1034978 - Unable to remove srpms from repo
Summary: Unable to remove srpms from repo
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: rpm-support
Version: 2.1.1
Hardware: x86_64
OS: Linux
medium
high
Target Milestone: ---
: 2.4.0
Assignee: Barnaby Court
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-26 19:30 UTC by Christina Plummer
Modified: 2014-08-09 06:56 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-08-09 06:56:09 UTC


Attachments (Terms of Use)

Description Christina Plummer 2013-11-26 19:30:11 UTC
Description of problem:
"pulp-admin rpm repo remove srpm" command does not work.  This is particularly problematic because when syncing from the Oracle Linux public yum repos, src RPMs are included.  Since it is not currently possible to filter out these packages from being synced in the first place, I would like to at least remove them after the fact to save disk space.  However, this does not work using pulp-admin.

Version-Release number of selected component (if applicable):
2.1.3-1.el6


How reproducible:
Always

Steps to Reproduce:
1. pulp-admin rpm repo content srpm --repo-id=live-ol5-x86_64-os --fields=filename,arch
2. pulp-admin rpm repo remove srpm --repo-id=live-ol5-x86_64-os -b 2013-11-25
3. Also tried: 
pulp-admin rpm repo remove srpm --repo-id=live-ol5-x86_64-os --str-eq="arch=src"
pulp-admin rpm repo content srpm --repo-id=live-ol5-x86_64-os --match="filename=zsh-4.2.6-8.el5.src.rpm"

Actual results:
Task shows success according to "pulp-admin repo tasks" but the packages are still there when I repeat step 1, no matter how I try the command.  I am using the same specifiers for both the "content" and "remove" commands, so I do not think it is a syntax error on my part.

Expected results:
SRPM packages should be removed

Additional info:
"pulp-admin rpm repo remove srpm" seems to require a filter be included on the command line (either a date specified by -a or -b, or a filter match of some sort).  I would prefer to be able to delete ALL SRPMS in one go, and there is nothing in the documentation to indicate that any parameter besides "--repo-id" as being required.

Comment 1 Christina Plummer 2013-11-26 19:42:06 UTC
Sorry, that last command under #3 should be:
pulp-admin rpm repo remove srpm --repo-id=live-ol5-x86_64-os --match="filename=zsh-4.2.6-8.el5.src.rpm"

Comment 2 Florian Sachs 2013-12-03 08:12:34 UTC
I think the problem is not connected to SRPMs, but "pulp-admin rpm repo content remove" does not work at all...

Description of Problem:
"pulp-admin rpm repo remove rpm" command does not work.

Version-Release number of selected component (if applicable):
pulp-server-2.2.1-1.fc19.noarch


How reproducible:
Always

Steps to Reproduce:
1. pulp-admin rpm repo content rpm --repo-id=postgres-9_2-el6 --fields=filename,description --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"
2. pulp-admin rpm repo remove  rpm --repo-id=postgres-9_2-el6 --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"                                                                                                           
3. pulp-admin rpm repo content rpm --repo-id=postgres-9_2-el6 --fields=filename,description --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"


Actual Results:
- The first command shows, that the rpm is correctly found:
# pulp-admin  rpm repo content rpm  --repo-id=postgres-9_2-el6 --fields=filename,description --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"
Description:  Multimedia add-on for the wxWidgets library.
Filename:     wxGTK-media-2.8.12-1.el6.x86_64.rpm

- The 'remove' command is called with the same parameters for repo-id and match, so the same content unit should be selected and removed.
# pulp-admin rpm repo remove rpm --repo-id=postgres-9_2-el6 --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"                                                                                                           
This command may be exited via ctrl+c without affecting the request.

[-]
Waiting to begin...

[-]
Running...

Units:
  wxGTK-media-2.8.12-1.el6-x86_64

- Calling the first command again shows, that the rpm is still associated with the repository
# pulp-admin  rpm repo content rpm  --repo-id=postgres-9_2-el6 --fields=filename,description --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"
Description:  Multimedia add-on for the wxWidgets library.
Filename:     wxGTK-media-2.8.12-1.el6.x86_64.rpm

- The task details for the given task returns that the operation "unassociate" was "successful"
saf@safedora:~ # pulp-admin tasks details --task-id=a5dce627-c50a-4291-8b42-02951bd74edc
+----------------------------------------------------------------------+
                              Task Details
+----------------------------------------------------------------------+

Operations:   unassociate
Resources:    postgres-9_2-el6 (repository)
State:        Successful
Start Time:   2013-12-03T07:56:46Z
...


Expected results:
The rpm package is no longer associated with the repository

Additional Info:
None

Comment 3 Florian Sachs 2013-12-03 14:31:36 UTC
In https://www.redhat.com/archives/pulp-list/2013-December/msg00006.html it was pointed out, that the behaviour from my comment #2 is actually expected behaviour, as content units cann not be removed from repositories, that are synched.

I can acknowledge, that removal is possible, wenn the repository is not synched (== no feed present)

* Please point it out in the documentation
* Please do not return a "successfull" unassociation in this case, as it will lead to wrong assumptions

My comment is resolved - the original bugreport is not.

@Christina: Sorry for messing up your bugreport - they looked quite similar to me...


FYI: The following commands allow me to remove content from the repository

# pulp-admin rpm repo create --repo-id=postgres-9_2-el6-release-tardis \
    --description="Postgres 9.2 EL6 Release Tardis" \
    --serve-http=True \
    --relative-url=postgres-9_2-el6-release-tardis

# pulp-admin rpm repo copy all \
  --from-repo-id=postgres-9_2-el6 \
  --to-repo-id=postgres-9_2-el6-release-tardis

# pulp-admin rpm repo content rpm 
  --repo-id=postgres-9_2-el6-release-tardis \
  --fields=filename,description\
  --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"

# pulp-admin rpm repo remove rpm \
  --repo-id=postgres-9_2-el6-release-tardis \
  --str-eq="filename=wxGTK-media-2.8.12-1.el6.x86_64.rpm"

Comment 4 Christina Plummer 2013-12-03 21:04:15 UTC
This may be primarily a documentation/error reporting problem, similar to Florian's.

I noticed that the output from the "pulp-admin {s,}rpm remove" command always appears the same, regardless of whether the package provided to remove or the repository to remove it from is valid.  

E.g. this command provides a package name that does not exist in the given repo, but the "remove" command still appears to succeed:
$ pulp-admin rpm repo content rpm --repo-id=unstable-rhel-6-x86_64-os --match name=made_up_pkg
$ pulp-admin rpm repo remove rpm --repo-id=unstable-rhel-6-x86_64-os --match name=made_up_pkg
Progress on this task can be viewed using the commands under "repo tasks".

$ pulp-admin repo tasks list --repo-id=unstable-rhel-6-x86_64-os
+----------------------------------------------------------------------+
                                 Tasks
+----------------------------------------------------------------------+

Operations:  unassociate
Resources:   unstable-rhel-6-x86_64-os (repository)
State:       Successful
Start Time:  2013-12-03T20:28:07Z
Finish Time: 2013-12-03T20:28:08Z
Result:      N/A
Task Id:     e2da6498-1a38-47a7-9ab3-42aec93522dc



And this command provides an invalid repo-id:
$ pulp-admin rpm repo content rpm --repo-id=unstable-rhel-6-x86_64 --match filename=yum-3.2.29-17.el6_1.1.noarch.rpm
The following resource(s) could not be found:

  unstable-rhel-6-x86_64 (repo_id)

$ pulp-admin rpm repo remove rpm --repo-id=unstable-rhel-6-x86_64 --match filename=yum-3.2.29-17.el6_1.1.noarch.rpm
Progress on this task can be viewed using the commands under "repo tasks".

$ pulp-admin repo tasks list --repo-id=unstable-rhel-6-x86_64
+----------------------------------------------------------------------+
                                 Tasks
+----------------------------------------------------------------------+

Operations:  unassociate
Resources:   unstable-rhel-6-x86_64 (repository)
State:       Successful
Start Time:  2013-12-03T20:23:33Z
Finish Time: 2013-12-03T20:23:33Z
Result:      N/A
Task Id:     c65b50f4-8a0a-4116-b388-1b3aae4b069c

Comment 5 Christina Plummer 2013-12-03 21:17:38 UTC
"pulp-admin rpm repo copy srpm" does not work either.  "copy rpm" does work.  See below.

$ pulp-admin rpm repo create --repo-id=test-ol5 --serve-http=true --serve-https=false --checksum-type=sha --gpg-key=/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle-el5
Successfully created repository [test-ol5]

$ pulp-admin rpm repo copy srpm --from-repo-id=live-ol5-x86_64-os --to-repo-id=test-ol5
Progress on this task can be viewed using the commands under "repo tasks".

$ pulp-admin repo tasks list --repo-id=test-ol5
+----------------------------------------------------------------------+
                                 Tasks
+----------------------------------------------------------------------+

Operations:  associate
Resources:   test-ol5 (repository), live-ol5-x86_64-os (repository)
State:       Successful
Start Time:  2013-12-03T21:11:01Z
Finish Time: 2013-12-03T21:11:18Z
Result:      N/A
Task Id:     d6b88a92-3068-44d0-bd6c-4c0eeed01e7f

$ pulp-admin rpm repo list
<snip>
Id:                  test-ol5
Display Name:        test-ol5
Description:         None
Content Unit Counts:
</snip>

$ $ pulp-admin rpm repo copy rpm --from-repo-id=live-ol5-x86_64-os --to-repo-id=test-ol5
Progress on this task can be viewed using the commands under "repo tasks".

$ pulp-admin repo tasks list --repo-id=test-ol5
+----------------------------------------------------------------------+
                                 Tasks
+----------------------------------------------------------------------+

Operations:  associate
Resources:   test-ol5 (repository), live-ol5-x86_64-os (repository)
State:       Successful
Start Time:  2013-12-03T21:11:49Z
Finish Time: 2013-12-03T21:12:00Z
Result:      N/A
Task Id:     ad8583fb-bcbd-4049-b0a7-f1ac4ede98d2

$ pulp-admin rpm repo list
<snip>
Id:                  test-ol5
Display Name:        test-ol5
Description:         None
Content Unit Counts:
  Rpm: 3994
</snip>

Comment 6 Barnaby Court 2013-12-20 19:10:46 UTC
Update output differentiate from the items that matched the query and the items that were actually deleted.  Results now list each.  

Pull Requests:
https://github.com/pulp/pulp/pull/750
https://github.com/pulp/pulp_puppet/pull/94
https://github.com/pulp/pulp_rpm/pull/427

Comment 7 Jeff Ortel 2014-04-03 13:35:44 UTC
build: 2.4.0-0.7.beta

Comment 8 Preethi Thomas 2014-04-22 16:02:31 UTC
verified

[root@pulp-24-server ~]# rpm -qa pulp-server
pulp-server-2.4.0-0.9.beta.el6.noarch
[root@pulp-24-server ~]# 


[root@pulp-24-server ~]# pulp-admin rpm repo  content  srpm --repo-id srpm
Arch:         src
Buildhost:    localhost
Checksum:     54cc4713fe704dfc7a4fd5b398f834ceb6a692f53b0c6aefaf89d88417b4c51d
Checksumtype: sha256
Description:   This is a test rpm
Epoch:        0
Filename:     ffb5ee15-86f4-467d-a3d3-3ebb9344f1c3
License:      GPLv2
Name:         test-srpm01
Provides:     
Release:      1
Requires:     
Vendor:       None
Version:      1.0


[root@pulp-24-server ~]# 
[root@pulp-24-server ~]# pulp-admin rpm repo  remove srpm --repo-id srpm --str-eq="name=test-srpm01"
This command may be exited via ctrl+c without affecting the request.


[\]
Running...

Units Removed:
  test-srpm01-1.0-1-src

[root@pulp-24-server ~]# pulp-admin rpm repo  content  srpm --repo-id srpm[root@pulp-24-server ~]# 


[root@pulp-24-server ~]# pulp-admin rpm repo copy srpm -f srpm -t srpm-copy
This command may be exited via ctrl+c without affecting the request.


[\]
Running...

Copied:
  test-srpm01-1.0-1-src

[root@pulp-24-server ~]#

Comment 9 Randy Barlow 2014-08-09 06:56:09 UTC
This has been fixed in Pulp 2.4.0-1.


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