Bug 618736 - pulp consumer delete does not have any error check for consumer ids
pulp consumer delete does not have any error check for consumer ids
Status: CLOSED CURRENTRELEASE
Product: Pulp
Classification: Community
Component: z_other (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Sayli Karmarkar
Preethi Thomas
:
Depends On:
Blocks: pulp-verified
  Show dependency treegraph
 
Reported: 2010-07-27 11:47 EDT by Preethi Thomas
Modified: 2015-03-22 21:10 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-08-16 10:02:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Preethi Thomas 2010-07-27 11:47:57 EDT
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 13:31:39 EDT
$ 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 09:06:08 EDT
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 12:14:17 EDT
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 14:33:46 EDT
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 10:02:56 EDT
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.