Bug 1007432

Summary: Deleting a user which has administrator role after performing a series of cli operations fails
Product: [Retired] Subscription Asset Manager Reporter: Tazim Kolhar <tkolhar>
Component: katelloAssignee: Tom McKay <tomckay>
Status: CLOSED ERRATA QA Contact: sthirugn <sthirugn>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.3CC: bkearney, cwelton, omaciel, sthirugn, tomckay, vkuznets
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 11:26:08 UTC Type: Bug
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: 833466    

Description Tazim Kolhar 2013-09-12 13:26:30 UTC
Description of problem:
Deleting a user which has administrator role after performing a series of Org operations fails

Version-Release number of selected component (if applicable):
# rpm -qa | grep katello
katello-cli-1.4.3-10.el6sat.noarch
katello-headpin-1.4.3-12.el6sam_splice.noarch
katello-configure-1.4.4-4.el6sat.noarch
katello-glue-candlepin-1.4.3-12.el6sam_splice.noarch
katello-selinux-1.4.4-2.el6sat.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
katello-cli-common-1.4.3-10.el6sat.noarch
katello-glue-elasticsearch-1.4.3-12.el6sam_splice.noarch
katello-common-1.4.3-12.el6sam_splice.noarch
katello-headpin-all-1.4.3-12.el6sam_splice.noarch


How reproducible:
everytime

Steps to Reproduce:

Create a User
1. # headpin -u admin -p **** user create --username testuser --password redhat --email testuser
Successfully created user [ testuser ]

Assign Admin rights
2. # headpin --username *** --password "admin" user assign_role --username "testuser" --role "Administrator" 
User 'testuser' assigned to role 'Administrator'

Create a Org using the new user's credentials
3. # headpin -u testuser -p **** org create --name torg
Successfully created org [ torg ]

Delete the org using the new user's credentials
4. # headpin -u testuser -p *** org delete --name torg
Successfully deleted org [ torg ]            

Try to delete that user
5. # headpin -u admin -p ***** user delete --username testuser
ERROR:  update or delete on table "users" violates foreign key constraint "task_statuses_user_id_fk" on table "task_statuses"
DETAIL:  Key (id)=(6) is still referenced from table "task_statuses".

Check if user is deleted
6. # headpin -u admin -p **** user list
--------------------------------------------------------------------------------
                                   User List

ID Username Email          Disabled Default Organization Default Environment 
--------------------------------------------------------------------------------
1  admin    root@localhost False    None                 None                
6  t123     t1  False    None                 None              

Actual results:
User is not deleted

Expected results:
User should be deleted successfully

Additional info:

Comment 1 Tom McKay 2013-09-13 13:18:30 UTC
[root@rhel64-update-5 ~]# headpin -u admin -p admin user create --username testuser --password redhat --email testuser
Successfully created user [ testuser ]
[root@rhel64-update-5 ~]# headpin --username admin --password "admin" user assign_role --username "testuser" --role "Administrator"
User 'testuser' assigned to role 'Administrator'
[root@rhel64-update-5 ~]# headpin -u testuser -p admin org create --name torg
Invalid credentials
[root@rhel64-update-5 ~]# headpin -u testuser -p redhat org create --name torg
Successfully created org [ torg ]
[root@rhel64-update-5 ~]# headpin -u testuser -p redhat org delete --name torg
Successfully deleted org [ torg ]            
[root@rhel64-update-5 ~]# headpin -u admin -p admin user delete --username testuser
Successfully deleted user [ testuser ]
[root@rhel64-update-5 ~]# headpin -u admin -p admin user list
-------------------------------------------------------------------------------------------------------------------------
                                                        User List

ID Username      Email                 Disabled Default Organization Default Environment 
-------------------------------------------------------------------------------------------------------------------------
3  UserAdminOne  UserAdminOne  False    None                 None                
4  UserSystemOne UserSystemOne False    None                 None                
1  admin         root@localhost        False    None                 None                
[root@rhel64-update-5 ~]#

Comment 2 sthirugn@redhat.com 2013-09-13 18:18:01 UTC
Verified.

* candlepin-0.8.26-1.el6sam.noarch
* candlepin-scl-1-5.el6_4.noarch
* candlepin-scl-quartz-2.1.5-5.el6_4.noarch
* candlepin-scl-rhino-1.7R3-1.el6_4.noarch
* candlepin-scl-runtime-1-5.el6_4.noarch
* candlepin-selinux-0.8.26-1.el6sam.noarch
* candlepin-tomcat6-0.8.26-1.el6sam.noarch
* elasticsearch-0.19.9-8.el6sat.noarch
* katello-candlepin-cert-key-pair-1.0-1.noarch
* katello-certs-tools-1.4.2-2.el6sat.noarch
* katello-cli-1.4.3-10.el6sat.noarch
* katello-cli-common-1.4.3-10.el6sat.noarch
* katello-common-1.4.3-13.el6sam_splice.noarch
* katello-configure-1.4.4-4.el6sat.noarch
* katello-glue-candlepin-1.4.3-13.el6sam_splice.noarch
* katello-glue-elasticsearch-1.4.3-13.el6sam_splice.noarch
* katello-headpin-1.4.3-13.el6sam_splice.noarch
* katello-headpin-all-1.4.3-13.el6sam_splice.noarch
* katello-selinux-1.4.4-2.el6sat.noarch
* thumbslug-0.0.34-1.el6sam.noarch
* thumbslug-selinux-0.0.34-1.el6sam.noarch

Comment 3 Tazim Kolhar 2013-09-16 06:25:49 UTC
Verified :

# rpm -qa | grep katello
katello-glue-candlepin-1.4.3-13.el6sam_splice.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
katello-cli-1.4.3-10.el6sat.noarch
katello-configure-1.4.4-4.el6sat.noarch
katello-glue-elasticsearch-1.4.3-13.el6sam_splice.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-cli-common-1.4.3-10.el6sat.noarch
katello-common-1.4.3-13.el6sam_splice.noarch
katello-headpin-1.4.3-13.el6sam_splice.noarch
katello-selinux-1.4.4-2.el6sat.noarch
katello-headpin-all-1.4.3-13.el6sam_splice.noarch


# headpin -u admin -p **** user create --username testuser --password **** --email testuser
Successfully created user [ testuser ]

# headpin --username admin --password **** user assign_role --username "testuser" --role "Administrator" 
User 'testuser' assigned to role 'Administrator'

# headpin -u testuser -p **** org create --name torg
Successfully created org [ torg ]

# headpin -u testuser -p **** org delete --name torg
Successfully deleted org [ torg ]        
    
# headpin -u admin -p **** user delete --username testuser
Successfully deleted user [ testuser ]

# headpin -u admin -p **** user list
------------------------------------------------------------------------------------------------------------------------------------------------------
                                                                      User List

ID Username Email          Disabled Default Organization Default Environment 
------------------------------------------------------------------------------------------------------------------------------------------------------
1  admin    root@localhost False    None                 None

Comment 5 errata-xmlrpc 2013-10-01 11:26:08 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2013-1390.html