Bug 629987

Summary: pakcagegroup add_package and delete_package does not check for actual packages
Product: [Retired] Pulp Reporter: Preethi Thomas <pthomas>
Component: z_otherAssignee: John Matthews <jmatthew>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: jmatthew, pkilambi, skarmark, tsanders, whayutin
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 14:01:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 641987    

Description Preethi Thomas 2010-09-03 12:55:34 UTC
Description of problem:

[root@preethi ~]# rpm -qa |grep pulp
pulp-client-0.0.59-1.fc13.noarch
pulp-common-0.0.59-1.fc13.noarch
pulp-0.0.59-1.fc13.noarch



Pakckagegroup add_package and delete_package option lets you add bogus packages which are not in the repository. You get a successful message.

 root@preethi ~]# pulp-admin packagegroup add_package --id=preethi --repoid=f13 --pkgname=preethi
Package [preethi] added to group [preethi] in repository [f13]
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# pulp-admin packagegroup delete_package --id=preethi --repoid=f13 --pkgname=preethi
Package [preethi] deleted from group [preethi] in repository [f13]
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# pulp-admin packagegroup delete_package --id=preethi --repoid=f13 --pkgname=system
Package [system] deleted from group [preethi] in repository [f13]
[root@preethi ~]# pulp-admin packagegroup delete_package --id=preethi --repoid=f13 --pkgname=none
Package [none] deleted from group [preethi] in repository [f13]
[root@preethi ~]# 

[root@preethi ~]# pulp-admin packagegroup list --repoid=f13 |grep preethi
	 preethi

Comment 2 Sayli Karmarkar 2010-09-18 04:22:37 UTC
Fixed. Now it raises exception if the package is not present in the repo. 

$ git commit src/pulp/server/api/repo.py -m "629987 - Adding a check for existing package in a repo before adding or deleting from package group"
Created commit 4093b0d: 629987 - Adding a check for existing package in a repo before adding or deleting from package group
 1 files changed, 63 insertions(+), 21 deletions(-)

Comment 3 Preethi Thomas 2010-10-07 15:29:51 UTC
reopening this. It does raises an exception. But would be better if there is more user friendly message.

[root@localhost ~]# pulp-admin packagegroup add_package --id=pkggrp1 -n preethi --repoid=f12
"Traceback (most recent call last):\n  File \"/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/base.py\", line 51, in report_error\n    return method(self, *args, **kwargs)\n  File \"/usr/lib/python2.6/site-packages/pulp/server/webservices/role_check.py\", line 102, in check_roles\n    result = f(instance, *fargs, **kw)\n  File \"/usr/lib/python2.6/site-packages/pulp/server/webservices/controllers/repositories.py\", line 327, in add_packages_to_group\n    return self.ok(api.add_packages_to_group(id, groupid, pkg_names, gtype))\n  File \"/usr/lib/python2.6/site-packages/pulp/server/auditing.py\", line 193, in _audit\n    result = method(*args, **kwargs)\n  File \"/usr/lib/python2.6/site-packages/pulp/server/api/repo.py\", line 608, in add_packages_to_group\n    % (groupid, repoid))\nPulpException: u'No PackageGroup with id: pkggrp1 exists in repo f12'\n"

Comment 4 John Matthews 2010-10-12 19:09:57 UTC
My understanding of package groups is that they may reference packages which do not exist in the repo.  It's possible to have a repo of only package groups and no packages.   The client will look at the aggregate of all repos and the package groups will be able to reference any of the available packages at install time.

To keep pulp consistent with this understanding I plan to change the behavior back to as it was.

For the delete case we can display an error deleting a package not in the group.

Comment 5 John Matthews 2010-10-14 12:59:45 UTC
This commit changes the behavior back so we can add a package to a group, even if it's not in the repo.

http://git.fedorahosted.org/git/?p=pulp.git;a=commit;h=27c0c414549be80aba0c2c0401e0384aabc7585b


When deleting a package from a package group, if the package to delete is not in the group we throw an exception.

Comment 6 Jay Dobies 2010-10-15 12:24:13 UTC
Fixed in the 0.73 release.

Comment 7 John Matthews 2010-10-15 12:47:32 UTC
This will be in 0.74

Comment 8 Jay Dobies 2010-10-15 18:52:41 UTC
Included in build 0.74.

Comment 9 Preethi Thomas 2010-10-18 16:19:46 UTC
verified


[root@preethi ~]# pulp-admin packagegroup add_package --repoid=f13 --id=preethi -n test
Following packages added to group [preethi] in repository [f13]: 
 ['test']
[root@preethi ~]# pulp-admin packagegroup delete_package --repoid=f13 --id=preethi -n test
Package [test] deleted from group [preethi] in repository [f13]

[root@preethi ~]# pulp-admin packagegroup delete_package --repoid=f13 --id=preethi -n test
Unable to delete [test] from group [preethi] in repository [f13]

[root@preethi ~]# pulp-admin packagegroup info --repoid=f13 --id=preethi
+------------------------------------------+
          Package Group Information
+------------------------------------------+

Name                	preethi                  
Id                  	preethi                  
Mandatory packages  	[]                       
Default packages    	[u'zsh']                 
Optional packages   	[]                       
Conditional packages	{}

Comment 10 Preethi Thomas 2011-08-16 14:01:02 UTC
Closing with Community Release 15

pulp-0.0.223-4.