Bug 618736 - pulp consumer delete does not have any error check for consumer ids
Summary: pulp consumer delete does not have any error check for consumer ids
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
: ---
Assignee: Sayli Karmarkar
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: pulp-verified
TreeView+ depends on / blocked
 
Reported: 2010-07-27 15:47 UTC by Preethi Thomas
Modified: 2015-03-23 01:10 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-16 14:02:56 UTC
Embargoed:


Attachments (Terms of Use)

Description Preethi Thomas 2010-07-27 15:47:57 UTC
Description of problem

pulp consumer delete does not have any error check against non existing consumer ids


[root@preethi ~]#  pulp consumer list
+-------------------------------------------+
    Consumer Information 
+-------------------------------------------+
[root@preethi ~]#  pulp consumer delete
 Successfully deleted consumer [preaathi1.75]
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]#  pulp consumer delete --id=
 Successfully deleted consumer [preaathi1.75]
[root@preethi ~]# 
[root@preethi ~]#  pulp consumer delete --id=10
 Successfully deleted consumer [10]
[root@preethi ~]#  pulp consumer delete --id=test
 Successfully deleted consumer [test]
[root@preethi ~]# 
[root@preethi ~]#  pulp consumer delete --help
Usage: pulp consumer delete [OPTIONS]

Options:
  -h, --help       show this help message and exit
  --id=CONSUMERID  Consumer Identifier

Comment 1 Sayli Karmarkar 2010-08-12 17:31:39 UTC
$ sudo pulp -u admin -p admin consumer delete --id=foo
 Deleted operation failed on Consumer [ foo ] 


$ tail -f /var/log/pulp/pulptools.log
2010-08-12 09:31:07,668 [ERROR][MainThread] _delete() @ core_consumer.py:244 - Error: 500: "Traceback (most recent call last):\n  File \"/usr/lib/python2.6/site-packages/pulp/webservices/controllers/base.py\", line 50, in report_error\n    return method(self, *args, **kwargs)\n  File \"/usr/lib/python2.6/site-packages/pulp/webservices/role_check.py\", line 102, in check_roles\n    ret=f(instance, *fargs, **kw)\n  File \"/usr/lib/python2.6/site-packages/pulp/webservices/controllers/consumers.py\", line 144, in DELETE\n    api.delete(id=id)\n  File \"/usr/lib/python2.6/site-packages/pulp/auditing.py\", line 186, in _audit\n    result = method(*args, **kwargs)\n  File \"/usr/lib/python2.6/site-packages/pulp/api/consumer.py\", line 74, in delete\n    raise PulpException('Consumer \"%s\" does not exist', id)\nPulpException: u'Consumer \"foo\" does not exist'\n"

Comment 2 Preethi Thomas 2010-08-13 13:06:08 UTC
Fails_qa

[root@preethi ~]# pulp-admin -u admin -p admin consumer list
+-------------------------------------------+
    Consumer Information 
+-------------------------------------------+

Id                 	preethi                  
Description        	test                     
Subscribed Repos   	/consumers/preethi/repoids/
Profile            	http://localhost:8811/consumers/preethi/package_profile/

[root@preethi ~]# pulp-admin -u admin -p admin consumer delete
consumer id required. Try --help
[root@preethi ~]# pulp-admin -u admin -p admin consumer delete --id=test
 Deleted operation failed on Consumer [ test ] 
[root@preethi ~]# pulp-admin -u admin -p admin consumer delete --id=preethi
 Successfully deleted consumer [preethi]
[root@preethi ~]# pulp-admin -u admin -p admin consumer delete --id=preethi
 Successfully deleted consumer [preethi]
[root@preethi ~]# pulp-admin -u admin -p admin consumer delete --id=preethi
 Successfully deleted consumer [preethi]
[root@preethi ~]# pulp-admin -u admin -p admin consumer list
+-------------------------------------------+
    Consumer Information 
+-------------------------------------------+

Id                 	preethi                  
Description        	test                     
Subscribed Repos   	/consumers/preethi/repoids/
Profile            	http://localhost:8811/consumers/preethi/package_profile/

Comment 3 Sayli Karmarkar 2010-09-22 16:14:17 UTC
Preethi,
As you can see, it was because of the bug where consumer delete operation was not deleting consumers from db, which is fixed now. Just now I tried it on my dev box and it works correctly. Moving to QA.

Comment 4 Preethi Thomas 2010-10-01 18:33:46 UTC
verified

[root@preethi ~]# pulp-admin -u admin -p admin consumer list
+------------------------------------------+
            Consumer Information 
+------------------------------------------+

Id                 	preethi.usersys.redhat.com
Description        	preethi.usersys.redhat.com
Subscribed Repos   	/pulp/api/consumers/preethi.usersys.redhat.com/repoids/
Profile            	https://preethi:443/pulp/api/consumers/preethi.usersys.redhat.com/package_profile/
Additional info    	{}                       


Id                 	10.16.120.215            
Description        	10.16.120.215            
Subscribed Repos   	/pulp/api/consumers/10.16.120.215/repoids/
Profile            	https://preethi:443/pulp/api/consumers/10.16.120.215/package_profile/
Additional info    	{}    
[root@preethi ~]# pulp-admin -u admin -p admin consumer delete --id=10.16.120.215
 Successfully deleted consumer [10.16.120.215]
[root@preethi ~]# pulp-admin -u admin -p admin consumer delete --id=10.16.120.215
 Deleted operation failed on consumer [ 10.16.120.215 ]

[root@preethi ~]# pulp-admin -u admin -p admin consumer list
+------------------------------------------+
            Consumer Information 
+------------------------------------------+

Id                 	preethi.usersys.redhat.com
Description        	preethi.usersys.redhat.com
Subscribed Repos   	/pulp/api/consumers/preethi.usersys.redhat.com/repoids/
Profile            	https://preethi:443/pulp/api/consumers/preethi.usersys.redhat.com/package_profile/
Additional info    	{}

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

pulp-0.0.223-4.


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