Bug 881568

Summary: [ALL LANG][SAM Web GUI] Unexpected error: Couldn't find Organization with ID=1 [WHERE "organizations"."task_id" IS NULL] occurred when failed deletion for the default org 'ACME_Corporation'.
Product: [Retired] Subscription Asset Manager Reporter: Lijun Li <lijli>
Component: katelloAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WONTFIX QA Contact: sthirugn <sthirugn>
Severity: high Docs Contact:
Priority: high    
Version: 1.3CC: athomas, bkearney, cwelton, lzap, qe-i18n-bugs, sthirugn, tomckay
Target Milestone: rcKeywords: i18n
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 882311 (view as bug list) Environment:
Last Closed: 2017-06-26 20:33:37 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: 1001609    
Bug Blocks: 882311, 971511    
Attachments:
Description Flags
Unexpected error: Couldn't find Organization with ID=1
none
kateloo-debug tarball
none
Delete ACME_Corporation
none
Error on trying to add ACME_Corporation after it is deleted none

Comment 1 Lijun Li 2012-11-29 06:19:43 UTC
*** Bug 881569 has been marked as a duplicate of this bug. ***

Comment 2 Lijun Li 2012-11-29 06:23:51 UTC
Created attachment 654004 [details]
Unexpected error: Couldn't find Organization with ID=1

Comment 3 Tom McKay 2012-12-12 15:15:39 UTC
Moving out as not a blocker. Could be result of slow-running background tasks during org deletion. Waiting a few minutes, the error message did not reappear.

Comment 4 Tom McKay 2012-12-12 15:16:02 UTC
Clearing needinfo

Comment 5 Lukas Zapletal 2012-12-13 17:06:09 UTC
@Marek - taking as I am alrady working on the same one:

https://bugzilla.redhat.com/show_bug.cgi?id=885261

Comment 7 Lukas Zapletal 2012-12-19 15:33:23 UTC
So I can confirm your katello-jobs service had not to be running or you just did it too fast. Sometimes org deletion can be put on hold for some time and you need to wait - the error will disappear once organization is deleted.

Current organization deletion code is not good and I hesitate to implement a workaround for it as we will refactor our orchestration shortly. This looks like a Release Note for both SE and SAM releases just to wait until org is deleted.

Comment 9 Lijun Li 2012-12-20 03:06:45 UTC
Created attachment 666495 [details]
kateloo-debug tarball

Comment 10 Lukas Zapletal 2013-01-11 17:20:26 UTC
The patch was finally merged upstream, please test accordingly as it completely change the way how we dealing with orgs being deleted: https://github.com/Katello/katello/pull/1358

Comment 11 Bryan Kearney 2013-06-06 20:50:31 UTC
Moving all POST / MODIFIED bugs to ON_QA due to the new builds.

Comment 12 Tazim Kolhar 2013-08-07 09:00:39 UTC
Created attachment 783747 [details]
Delete ACME_Corporation

# rpm -qa | grep katello
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-common-1.4.3-5.el6sam_splice.noarch
katello-configure-1.4.4-2.el6sat.noarch
katello-cli-common-1.4.3-4.el6sat.noarch
katello-glue-elasticsearch-1.4.3-5.el6sam_splice.noarch
katello-headpin-all-1.4.3-5.el6sam_splice.noarch
katello-cli-1.4.3-4.el6sat.noarch
katello-glue-candlepin-1.4.3-5.el6sam_splice.noarch
signo-katello-0.0.10-2.el6sat.noarch
katello-headpin-1.4.3-5.el6sam_splice.noarch

# headpin -u admin -p admin org list
--------------------------------------------------------------------------------
                               Organization List

ID Name    Label   Description 
--------------------------------------------------------------------------------
3  Red Hat Red_Hat             
2  test    test             

Here,if you see a newly created org has got the ID -2,3

Comment 13 Bryan Kearney 2013-08-14 20:18:44 UTC
This code appears to be to in the delivery.

Comment 14 sthirugn@redhat.com 2013-08-16 20:29:28 UTC
Failed.  Attempted to delete ACME_Corporation and got a user message that the org is scheduled to be deleted.

I waited for few minkutes and attempted to create ACME_Corporation again, but it wouldn't let me do it. (UI Screenshot attached)

Version tested:
* candlepin-0.8.20-1.el6sam.noarch
* candlepin-cert-consumer-cloud-qe-21.idm.lab.bos.redhat.com-1.0-1.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.20-1.el6sam.noarch
* candlepin-tomcat6-0.8.20-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-7.el6sat.noarch
* katello-cli-common-1.4.3-7.el6sat.noarch
* katello-common-1.4.3-8.el6sam_splice.noarch
* katello-configure-1.4.4-2.el6sat.noarch
* katello-glue-candlepin-1.4.3-8.el6sam_splice.noarch
* katello-glue-elasticsearch-1.4.3-8.el6sam_splice.noarch
* katello-headpin-1.4.3-8.el6sam_splice.noarch
* katello-headpin-all-1.4.3-8.el6sam_splice.noarch
* katello-selinux-1.4.4-2.el6sat.noarch
* thumbslug-0.0.32-1.el6sam.noarch
* thumbslug-selinux-0.0.32-1.el6sam.noarch

Comment 15 sthirugn@redhat.com 2013-08-16 20:30:14 UTC
Created attachment 787455 [details]
Error on trying to add ACME_Corporation after it is deleted

Comment 17 Lukas Zapletal 2013-08-20 08:15:52 UTC
My patch can be considered as verified, because it works. This is different error introduced when foreign keys were implemented. Open a bug with this topic:

    Foreign key is preventing an org from being deleted.

The error message is:

2013-08-16T14:04:01-0400: [Worker(delayed_job host:cloud-qe-21.idm.lab.bos.redhat.com pid:7267)] 1 jobs processed at 8.4682 j/s, 1 failed ...
2013-08-16T15:57:10-0400: [Worker(delayed_job host:cloud-qe-21.idm.lab.bos.redhat.com pid:7267)] OrganizationDestroyer#run failed with ActiveRecord::                  +InvalidForeignKey: PGError: ERROR:  update or delete on table "organizations" violates foreign key constraint "notices_organization_id_fk" on table "notices"
DETAIL:  Key (id)=(1) is still referenced from table "notices".
: COMMIT - 0 failed attempts
2013-08-16T15:57:10-0400: [Worker(delayed_job host:cloud-qe-21.idm.lab.bos.redhat.com pid:7267)] PERMANENTLY removing OrganizationDestroyer#run because of 1           +consecutive failures.
PGError: ERROR:  update or delete on table "organizations" violates foreign key constraint "notices_organization_id_fk" on table "notices"
DETAIL:  Key (id)=(1) is still referenced from table "notices".
: COMMIT

Comment 18 sthirugn@redhat.com 2013-08-28 14:53:43 UTC
An other bug is created https://bugzilla.redhat.com/show_bug.cgi?id=1001609 to track the foreign key error.

Comment 19 Lukas Zapletal 2014-03-12 10:22:09 UTC
This should be re-investigated, not sure if this is relevant due to dynflow change.

Comment 21 Bryan Kearney 2017-06-26 20:33:37 UTC
The release of Satellite 5.8 we are deprecating the support of Subscription Asset Manager. The release notes for 5.8 can be found at https://access.redhat.com/documentation/en-us/red_hat_satellite/5.8/pdf/release_notes/Red_Hat_Satellite-5.8-Release_Notes-en-US.pdf.

I am therefore closing out this bug as WONTFIX. If you believe this to be an error, please feel free tor each out to either Rich Jerrido or Bryan Kearney. Thank you!