Bug 669215

Summary: Need a cleaner error message when adding a group key-value pair when it conflicts with a member's existing key
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: ---   
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:06:32 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 21:39:46 UTC
$ pulp-admin consumergroup list
+------------------------------------------+
      List of Available Consumer Groups
+------------------------------------------+

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



 -> sudo pulp-admin consumer list
+------------------------------------------+
            Consumer Information
+------------------------------------------+

Id                 	foo                      
Description        	None                     
Subscribed Repos   	/pulp/api/consumers/foo/repoids/
Additional info    	jdob  :  consumer-value, 


 -> sudo pulp-admin consumergroup add_keyvalue --id test-group --key jdob --value group-value
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 142, in add_key_value_pair
    api.add_key_value_pair(id, data['key'], data['value'], data['force'])
  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 212, in add_key_value_pair
    'delete consumer\'s original value.', key, conflicting_consumers)
PulpException: "Given key [jdob] has different value for consumers [u'foo'] belonging to this group. You can use --force to delete consumer's original value."

Comment 1 Sayli Karmarkar 2011-03-14 22:56:42 UTC
This seems to be fixed because of jconnor and jmatthews's fixes for server side
traceback.  

$ sudo pulp-admin consumergroup add_keyvalue --id=consumergroup1 --key=key2 --value=foo

error: operation failed: PulpException: "Given key [key2] has different value for consumers [u'consumer1'] belonging to this group. You can use --force to delete consumer's original value."

Comment 2 Preethi Thomas 2011-03-28 14:41:34 UTC
verified
[root@preethi ~]# rpm -q pulp
pulp-0.0.157-1.git.1.1ea502c.fc14.noarch


[root@preethi ~]# pulp-admin consumergroup add_keyvalue  --id test-group --key preethi --value group-value
error: operation failed: PulpException: "Given key [preethi] has different value for consumers [u'preethi.usersys.redhat.com'] belonging to this group. You can use --force to delete consumer's original value."



[root@preethi ~]# pulp-admin consumergroup add_keyvalue  --id test-group --key preethi --value group-value --force
Successfully added key-value pair preethi:group-value

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

Id                 	test-group               
Description        	None                     
Consumer ids       	['preethi.usersys.redhat.com']
Additional info    	preethi  :  group-value, 


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

Id                 	preethi.usersys.redhat.com
Description        	None                     
Subscribed Repos   	[]                       
Agent:
   Responding      	Yes                      
   Last Heartbeat  	2011-03-28T14:49:58.926558
Additional info    	preethi  :  group-value,

Comment 3 Preethi Thomas 2011-08-16 12:06:32 UTC
Closing with Community Release 15

pulp-0.0.223-4.

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

pulp-0.0.223-4.