Bug 684337 - Need a better error message when A consumer can have multiple values if it belongs to multiple consumer groups
Summary: Need a better error message when A consumer can have multiple values if it be...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: ---
Assignee: Pradeep Kilambi
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: verified-to-close
TreeView+ depends on / blocked
 
Reported: 2011-03-11 20:32 UTC by Preethi Thomas
Modified: 2011-08-16 12:21 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 669209
Environment:
Last Closed: 2011-08-16 12:07:30 UTC
Embargoed:


Attachments (Terms of Use)

Description Preethi Thomas 2011-03-11 20:32:25 UTC
+++ This bug was initially created as a clone of Bug #669209 +++

To replicate:
- Create a consumer
- Create a group (group A) with a key-value pair
- Create a group (group B) with the same key but a different value
- Assign the consumer to both groups


Here is the state in my example after running the above scenario:

$ pulp-admin consumergroup list
+------------------------------------------+
      List of Available Consumer Groups
+------------------------------------------+

Id                 	test-group               
Description        	Test Consumer Group      
Consumer ids       	['foo']                  
Additional info    	{'jdob': 'A'}      


Id                 	test-group-2                      
Description        	None                     
Consumer ids       	['foo']                  
Additional info    	{'jdob': 'B'}        



$ pulp-admin consumer get_keyvalues --id foo
+------------------------------------------+
             Consumer Key-values
+------------------------------------------+

	KEY            :	VALUE          

--------------------------------------------

	jdob           :	A

--- Additional comment from skarmark on 2011-02-22 15:02:55 EST ---

Fixed -

$ sudo pulp-admin consumergroup create --id=test-group
Successfully created Consumer group [ test-group ] with description [ None ]

$ sudo pulp-admin consumergroup create --id=test-group-2
Successfully created Consumer group [ test-group-2 ] with description [ None ]

$ sudo pulp-client consumer create --id=foo
Successfully created consumer [ foo ]

$ sudo pulp-admin consumergroup add_keyvalue --key=jdob --value=A --id=test-group
Successfully added key-value pair jdob:A

$ sudo pulp-admin consumergroup add_keyvalue --key=jdob --value=B --id=test-group-2
Successfully added key-value pair jdob:B

$ sudo pulp-admin consumergroup list
+------------------------------------------+
      List of Available Consumer Groups
+------------------------------------------+

Id                 	test-group               
Description        	None                     
Consumer ids       	[]                       
Additional info    	jdob  :  A,              


Id                 	test-group-2             
Description        	None                     
Consumer ids       	[]                       
Additional info    	jdob  :  B,              

$ sudo pulp-admin consumergroup add_consumer --id=test-group --consumerid=foo
Successfully added consumer [foo] to group [test-group]

$ sudo pulp-admin consumergroup add_consumer --id=test-group-2 --consumerid=foo
error: operation failed: Traceback (most recent call last):
  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/base.py", line 52, in report_error
    return method(self, *args, **kwargs)
  File "/home/skarmark/git/pulp/src/pulp/server/compat.py", line 40, in _decorator
    return decorator(*args,**kwargs)
  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/base.py", line 131, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/consumergroups.py", line 248, in POST
    return action(id)
  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/consumergroups.py", line 185, in add_consumer
    api.add_consumer(id, data)
  File "/home/skarmark/git/pulp/src/pulp/server/compat.py", line 40, in _decorator
    return decorator(*args,**kwargs)
  File "/home/skarmark/git/pulp/src/pulp/server/auditing.py", line 207, in _audit
    result = method(*args, **kwargs)
  File "/home/skarmark/git/pulp/src/pulp/server/api/consumer_group.py", line 107, in add_consumer
    'in order to add it to this consumergroup: %s', consumerid, groupid, conflicting_keyvalues)
PulpException: u"Consumer [foo] cannot be added to consumergroup [test-group-2] because of the following conflicting key-value pairs. You need to delete these key-values from the consumer in order to add it to this consumergroup: {u'jdob': u'A'}"


$ sudo pulp-admin consumer get_keyvalues --id=foo
+------------------------------------------+
             Consumer Key-values
+------------------------------------------+

	KEY            :	VALUE          

--------------------------------------------

	jdob           :	A

--- Additional comment from jortel on 2011-02-23 12:56:53 EST ---

Build: 0.141

Comment 1 Preethi Thomas 2011-03-11 20:34:03 UTC
Need better error message on the client.

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

Id                 	test-group               
Description        	None                     
Consumer ids       	[]                       
Additional info    	preethi  :  A,           


Id                 	test-group-2             
Description        	None                     
Consumer ids       	[]                       
Additional info    	preethi  :  B,           

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

[root@preethi ~]# pulp-admin consumergroup add_consumer --consumerid=preethi --id=test-group-2
error: operation failed:

Comment 2 Sayli Karmarkar 2011-03-16 07:14:48 UTC
$ sudo pulp-admin consumergroup list
+------------------------------------------+
      List of Available Consumer Groups
+------------------------------------------+

Id                 	test-group               
Description        	None                     
Consumer ids       	[]                       
Additional info    	preethi  :  A,           


Id                 	test-group-2             
Description        	None                     
Consumer ids       	[]                       
Additional info    	preethi  :  B,           

$ pulp-admin consumergroup add_consumer --consumerid=fred --id=test-group
Successfully added consumer [fred] to group [test-group]

$ pulp-admin consumergroup add_consumer --consumerid=fred --id=test-group-2
error: operation failed: PulpException: u"Consumer [fred] cannot be added to consumergroup [test-group-2] because of the following conflicting key-value pairs. You need to delete these key-values from the consumer in order to add it to this consumergroup: {u'preethi': u'A'}"

Comment 3 Preethi Thomas 2011-03-18 18:11:52 UTC
verified
[root@preethi ~]# rpm -q pulp
pulp-0.0.151-1.fc14.noarch


[root@preethi ~]# pulp-admin consumergroup add_consumer --id=test-group-2 --consumerid=preethi
error: operation failed: PulpException: u"Consumer [preethi] cannot be added to consumergroup [test-group-2] because of the following conflicting key-value pairs. You need to delete these key-values from the consumer in order to add it to this consumergroup: {u'preethi': u'A'}"

Comment 4 Preethi Thomas 2011-08-16 12:07:30 UTC
Closing with Community Release 15

pulp-0.0.223-4.

Comment 5 Preethi Thomas 2011-08-16 12:21:04 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.