Bug 669197

Summary: Need a cleaner error message when adding an invalid consumer to a group
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: z_otherAssignee: Sayli Karmarkar <skarmark>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: cperry, jconnor, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 20   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 12:11:17 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: 647488    

Description Jay Dobies 2011-01-12 20:58:32 UTC
In the following example, test-group is a valid consumer group but foobar is not a valid consumer.

-> pulp-admin consumergroup add_consumer --consumerid foobar --id test-group
error: operation failed: Traceback (most recent call last):
  File "/home/jdob/code/pulp/src/pulp/server/webservices/controllers/base.py", line 57, in report_error
    return method(self, *args, **kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/webservices/role_check.py", line 131, in check_roles
    result = f(instance, *fargs, **kw)
  File "/home/jdob/code/pulp/src/pulp/server/webservices/controllers/consumergroups.py", line 227, in POST
    return action(id)
  File "/home/jdob/code/pulp/src/pulp/server/webservices/controllers/consumergroups.py", line 169, in add_consumer
    api.add_consumer(id, data)
  File "/home/jdob/code/pulp/src/pulp/server/compat.py", line 38, in _decorator
    return decorator(*args,**kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/auditing.py", line 204, in _audit
    result = method(*args, **kwargs)
  File "/home/jdob/code/pulp/src/pulp/server/api/consumer_group.py", line 103, in add_consumer
    raise PulpException("No Consumer with id: %s found" % consumerid)
PulpException: 'No Consumer with id: foobar found'

Comment 1 Sayli Karmarkar 2011-01-26 02:08:26 UTC
Fixed.

$ sudo pulp-admin consumergroup add_consumer --id=foobar --consumerid=consumer1
error: operation failed: Consumer group with id: foobar, does not exist

Comment 2 Sayli Karmarkar 2011-01-26 02:19:55 UTC
$ sudo pulp-admin consumergroup add_consumer --id=foobar --consumerid=foobar
error: operation failed: Consumer with id: foobar, does not exist

Comment 3 Jay Dobies 2011-01-26 21:27:21 UTC
Fixed in 0.132.

Comment 4 Preethi Thomas 2011-01-31 15:38:53 UTC
fails_qa

Looks like its a fail. See below.

I have consumergroup as my group, but no consumer as test

but the failure message says

error: operation failed: Consumer with id: mygroup, does not exist

instead what it should say is

error: operation failed: Consumer with id: test, does not exist

[root@preethi ~]# pulp-admin consumergroup list
+------------------------------------------+
      List of Available Consumer Groups
+------------------------------------------+

Id                      mygroup                  
Description             None                     
Consumer ids            []                       
Additional info         {}                       


[root@preethi ~]# pulp-admin consumergroup add_consumer --id=mygroup --consumerid=preethi
Successfully added consumer [preethi] to group [mygroup]

[root@preethi ~]# pulp-admin consumergroup add_consumer --id=mygroup --consumerid=test
error: operation failed: Consumer with id: mygroup, does not exist

Comment 5 Sayli Karmarkar 2011-02-04 04:27:16 UTC
Fixed and also changed error message to make it similar to one for non-existing consumer group id.

$ sudo pulp-admin consumergroup add_consumer --id=mygroup --consumerid=test
error: operation failed: Consumer [test] does not exist

Comment 6 Jay Dobies 2011-02-04 19:24:04 UTC
Fixed in 0.135.

Comment 7 Preethi Thomas 2011-02-07 20:20:47 UTC
verified
[root@preethi ~]# rpm -q pulp
pulp-0.0.135-1.fc14.noarch


[root@preethi ~]# pulp-admin consumergroup add_consumer --consumerid foobar --id mygroup
error: operation failed: Consumer [foobar] does not exist
[root@preethi ~]# pulp-admin consumergroup add_consumer --consumerid foobar --id mygroup1
error: operation failed: Consumer Group [mygroup1] does not exist

Comment 8 Preethi Thomas 2011-08-16 12:11:17 UTC
Closing with Community Release 15

pulp-0.0.223-4.

Comment 9 Preethi Thomas 2011-08-16 12:22:50 UTC
Closing with Community Release 15

pulp-0.0.223-4.