Bug 1019246 - oo-admin-ctl-app got broken when a cartridge that does not belong to this app is passed in to --cartridge option
oo-admin-ctl-app got broken when a cartridge that does not belong to this app...
Product: OpenShift Online
Classification: Red Hat
Component: Pod (Show other bugs)
Unspecified Unspecified
medium Severity low
: ---
: ---
Assigned To: Ravi Sankar
libra bugs
Depends On:
  Show dependency treegraph
Reported: 2013-10-15 07:16 EDT by Jianwei Hou
Modified: 2015-05-14 20:21 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2014-01-23 22:24:08 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jianwei Hou 2013-10-15 07:16:12 EDT
Description of problem:
When a cartridge that does not belong to an application is passed in to --cartridge option of oo-admin-ctl-app, the program got broken, the exception is handled by mongoid

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

How reproducible:

Steps to Reproduce:
1. Create a scalable php application
2. Set the multiplier of the application, pass in 'diy-0.1' to the --cartridge option
oo-admin-ctl-app -l jhou@redhat.com -a php1s -c set-multiplier --cartridge diy-0.1 --multiplier 2

Actual results:
The program is broken
[root@ip-10-182-168-224 ~]# oo-admin-ctl-app -l jhou@redhat.com -a php1s -c set-multiplier --cartridge diy-0.1 --multiplier 2
/opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/finders.rb:96:in `find_by':  (Mongoid::Errors::DocumentNotFound)
  Document not found for class ComponentInstance with attributes {:cartridge_name=>"diy-0.1"}.
  When calling ComponentInstance.find_by with a hash of attributes, all attributes provided must match a document in the database or this error will be raised.
  Search for attributes that are in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error.
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/criteria.rb:731:in `block in method_missing'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/scoping.rb:190:in `with_scope'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/criteria.rb:730:in `method_missing'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/embedded/many.rb:398:in `block in method_missing'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/scoping.rb:190:in `with_scope'
	from /opt/rh/ruby193/root/usr/share/gems/gems/mongoid-3.0.21/lib/mongoid/relations/embedded/many.rb:397:in `method_missing'
	from /usr/sbin/oo-admin-ctl-app:195:in `<main>'

Expected results:
Maybe we should properly handle this exception when a cartridge is not in the component_instances of the application

Additional info:
This is also reproducible when doing start/create and such commands.
Comment 1 Ravi Sankar 2013-11-08 20:42:57 EST
Fixed in https://github.com/openshift/origin-server/pull/4144
Comment 2 openshift-github-bot 2013-11-08 22:59:10 EST
Commits pushed to master at https://github.com/openshift/origin-server

Bug 1019246 - Handle errors in setting multiplier for the cartridge

Merge pull request #4144 from pravisankar/dev/ravi/bug1019246

Merged by openshift-bot
Comment 3 Jianwei Hou 2013-11-10 21:25:32 EST
Verified on devenv_4016, the exception is handled now.

[root@ip-10-158-73-211 ~]# oo-admin-ctl-app  -l jhou@redhat.com -a php1s -c set-multiplier --cartridge php-5.3 --multiplier 3
Cannot set multiplier factor. Cartridge php-5.3 needs to be a sparse cart.

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