Bug 980333 - Met Mongoid::Errors::DeleteRestriction when deleting a domain with app by oo-admin-ctl-domain
Met Mongoid::Errors::DeleteRestriction when deleting a domain with app by oo-...
Status: CLOSED CURRENTRELEASE
Product: OpenShift Online
Classification: Red Hat
Component: Pod (Show other bugs)
2.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Ravi Sankar
libra bugs
: Regression
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-02 02:02 EDT by chunchen
Modified: 2016-09-29 22:15 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-07-22 11:19:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description chunchen 2013-07-02 02:02:03 EDT
Description of problem:
If deleting a domain with app by oo-admin-ctl-domain, will meet Mongoid::Errors::DeleteRestriction errors.

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

How reproducible:
always

Steps to Reproduce:
1. Setup an account and create a domain named "cdm"
rhc setup --server ec2-54-242-245-159.compute-1.amazonaws.com -l chunchen
2. Create an app
rhc app create cdiy diy-0.1 --no-git
3. SSH into the instance and delete this domain by oo-admin-ctl-domain
oo-admin-ctl-domain -l chunchen -c delete -n cdm

Actual results:
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/cascading/restrict.rb:32:in `cascade':  (Mongoid::Errors::DeleteRestriction)
Problem:
  Cannot delete Domain because of dependent 'applications'.
Summary:
  When defining 'applications' with a :dependent => :restrict, Mongoid will raise an error when attempting to delete the Domain when the child 'applications' still has documents in it.
Resolution:
  Don't attempt to delete the parent Domain when it has children, or change the dependent option on the relation.
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/cascading.rb:32:in `block in cascade!'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/cascading.rb:28:in `each'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/cascading.rb:28:in `cascade!'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/persistence/deletion.rb:22:in `prepare'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/persistence/operations/remove.rb:26:in `persist'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/persistence.rb:62:in `remove'
	from /usr/sbin/oo-admin-ctl-domain:257:in `<main>'


Expected results:
Should only return a short error messages like "Your domain contains applications. Delete applications first."

Additional info:
Comment 1 Ravi Sankar 2013-07-05 18:45:18 EDT
Fixed in https://github.com/openshift/origin-server/pull/2994
Comment 2 openshift-github-bot 2013-07-05 20:00:15 EDT
Commits pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/258dcb2d73dea5b3edc18e8bfb7442b2164212b0
Bug 980333 - Add missing 'exit 1' in oo-admin-ctl-domain

https://github.com/openshift/origin-server/commit/179cbade56db0d92ab6f7eac50a75a0e6cf3ca62
Merge pull request #2994 from pravisankar/dev/ravi/bug980333

Merged by openshift-bot
Comment 3 chunchen 2013-07-07 23:32:55 EDT
It's fixed, checked on devenv_3456, please help to change status to ON_QA, then i will modify to VERIFIED. Please refer to the following results:

1. Setup an account and create a domain named "cdm"
2. Create an app
3. SSH into the instance and delete this domain by oo-admin-ctl-domain
oo-admin-ctl-domain -l chunchen -c delete -n cdm

Actual results:
User still has applications. Delete them first.

Note You need to log in before you can comment on or make changes to this bug.