Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 977744

Summary: Deleting an org that has an active sync fails (partially)
Product: Red Hat Satellite Reporter: Ade Bradshaw <abradshaw>
Component: Content ManagementAssignee: Partha Aji <paji>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: cwelton, ehelms, jmontleo, kbidarka, mmccune
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-24 17:09:10 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: 1002495    

Description Ade Bradshaw 2013-06-25 09:11:31 UTC
Description of problem:


Version-Release number of selected component (if applicable):

I had an active sync running for the default org, and during the creation of a new org, I decided to delete the original. The org disappeared from the UI but after a few mins there was a popup error saying the org could not be deleted. I am guessing this is due to the active sync running in pulp

How reproducible:
Dont know, only tried once

Steps to Reproduce:
1. start a sync to the default org
2. switch to another org and delete the default org
3.

Actual results:
Org disappears from the UI but throws an error about not being able to delete the org

Expected results:
Either a messages saying "cant delete an org with an active sync, or it to wait for the sync to finish and then delete the org

Additional info:
foreman-installer-puppet-foreman-0-6.568c5c4.el6sat.noarch
foreman-proxy-installer-1.0.1-10.f5ae2cd.el6sat.noarch
ruby193-rubygem-foreman_api-0.1.3-3.el6_4.noarch
foreman-proxy-1.1.10003-1.el6sat.noarch
katello-common-1.4.2-17.el6sat.noarch
katello-glue-pulp-1.4.2-17.el6sat.noarch
katello-all-1.4.2-17.el6sat.noarch
katello-qpid-client-key-pair-1.0-1.noarch
python-oauth2-1.5.170-3.pulp.el6sat.noarch
foreman-installer-puppet-dns-0-7.fcae203.el6sat.noarch
m2crypto-0.21.1.pulp-8.el6sat.x86_64
python-isodate-0.5.0-1.pulp.el6sat.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
foreman-installer-puppet-puppet-0-3.ab46748.el6sat.noarch
mod_wsgi-3.4-1.pulp.el6sat.x86_64
katello-cli-common-1.4.2-8.el6sat.noarch
foreman-installer-puppet-tftp-0-5.ea6c5e5.el6sat.noarch
foreman-1.1.10014-1.noarch
ruby193-rubygem-foreman-katello-engine-0.0.8-6.el6sat.noarch
pulp-rpm-plugins-2.1.2-1.el6sat.noarch
katello-configure-1.4.3-16.el6sat.noarch
pulp-selinux-2.1.2-1.el6sat.noarch
signo-katello-0.0.19-1.el6sat.noarch
katello-glue-candlepin-1.4.2-17.el6sat.noarch
katello-glue-elasticsearch-1.4.2-17.el6sat.noarch
katello-1.4.2-17.el6sat.noarch
katello-configure-foreman-1.4.3-16.el6sat.noarch
katello-foreman-all-1.4.2-17.el6sat.noarch
foreman-installer-puppet-foreman_proxy-0-8.bd1e35d.el6sat.noarch
foreman-installer-puppet-xinetd-0-50a267b8.git.0.44aca6a.el6sat.noarch
foreman-installer-puppet-dhcp-0-5.3a4a13c.el6sat.noarch
katello-cli-1.4.2-8.el6sat.noarch
foreman-installer-puppet-concat-0-2.d776701.git.0.21ef926.el6sat.noarch
python-pulp-common-2.1.2-1.el6sat.noarch
foreman-postgresql-1.1.10014-1.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
pulp-server-2.1.2-1.el6sat.noarch
ruby193-rubygem-katello_api-0.0.3-2.el6_4.noarch
katello-selinux-1.4.3-3.el6sat.noarch
ruby193-rubygem-katello-foreman-engine-0.0.3-6.el6sat.noarch
katello-candlepin-cert-key-pair-1.0-1.noarch
python-pulp-rpm-common-2.1.2-1.el6sat.noarch
python-rhsm-1.8.0-1.pulp.el6sat.x86_64

Comment 1 RHEL Program Management 2013-09-17 04:25:09 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 3 Corey Welton 2013-09-17 21:42:28 UTC
We need to check and see if this puts the system in a bad state (corrupted data, etc.) -- if so, raise sev.

Comment 5 Eric Helms 2013-10-01 13:07:49 UTC
Testing this behavior on latest I am not able to reproduce. After creating an organization, starting a sync, waiting for the sync to get partially done and then attempting to delete the organization occurs successfully for me.

Comment 6 Kedar Bidarkar 2013-10-21 11:51:26 UTC
We get the below notice when trying to delete it.

 Failed to delete organization 'kedar_Test'

2013-10-21T07:33:28-0400: [Worker(delayed_job host:cloud-qe-8.idm.lab.bos.redhat.com pid:17019)] OrganizationDestroyer#run failed with NoMethodError: undefined method `editable?' for nil:NilClass - 0 failed attempts
2013-10-21T07:33:28-0400: [Worker(delayed_job host:cloud-qe-8.idm.lab.bos.redhat.com pid:17019)] PERMANENTLY removing OrganizationDestroyer#run because of 1 consecutive failures.
undefined method `editable?' for nil:NilClass
/usr/share/katello/app/models/authorization/repository.rb:31:in `deletable?'
/usr/share/katello/app/models/repository.rb:307:in `assert_deletable'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:407:in `_run__2602415743000240731__destroy__4015956763612595372__callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_destroy_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/callbacks.rb:254:in `destroy'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:236:in `block in destroy'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:208:in `transaction'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
/opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/transactions.rb:236:in `destroy'
/usr/share/katello/app/models/glue.rb:93:in `destroy'

The above traceback is from /var/log/katello/delayed_job.log


Will be updating the katello-debug report shortly.

Comment 8 Kedar Bidarkar 2013-10-21 12:09:26 UTC
This bug would also lead to a situation, where in one could no longer upload the manifest (used in the deleted org) to another org, as the org deletion had failed and there is no way from the UI to delete the manifest as the org is no longer visible.

Comment 9 Kedar Bidarkar 2013-10-21 12:12:01 UTC
Looks like a blocker issue to me as per above comment8.

Comment 10 Mike McCune 2013-10-22 02:58:59 UTC
we don't use the blocker flag, FYI

Comment 11 Petr Chalupa 2013-10-29 09:02:53 UTC
When line https://github.com/Katello/katello/blob/master/app/models/authorization/repository.rb#L31 is evaluated it's running in transaction where product of the repository was already deleted, so the method #product is returning nil and can't verify that the repository is #deletable?. All #(before|after)_destroy callbacks appear correctly defined before all associations with `:dependent` option. So the bug is probably in order of destroy callbacks defined by association's `:dependent` option. Changing order of associations or verifying of all #deletable? conditions before any destruction should fix the problem. Ping me if more information is needed.

Comment 12 Partha Aji 2013-10-29 22:21:43 UTC
should be fixed when https://github.com/Katello/katello/pull/3284 gets merged to master

Comment 13 Partha Aji 2013-10-29 22:23:57 UTC
should be fixed in the next build

c89ad4ad8a251fa898d8bfebf1e7ab1c2f16eae2

Comment 14 Mike McCune 2013-10-29 23:53:59 UTC
tested partha's patch and it did indeed seem to fix the issue for me.

Comment 17 Corey Welton 2013-10-31 17:43:01 UTC
I no longer get this message in the latest snap.  I'm told org is scheduled for background deletion and disappears from UI, without error.

QA Verified Satellite-6.0.2-RHEL-6-20131030.0

Comment 18 Bryan Kearney 2014-04-24 17:09:10 UTC
This was verified and delivered with MDP2. Closing it out.

Comment 19 Bryan Kearney 2014-04-24 17:10:45 UTC
This was delivered and verified with MDP2. Closing the bug.